diff --git a/src/components/views/dialogs/ChatInviteDialog.js b/src/components/views/dialogs/ChatInviteDialog.js
index 7ed7be1c15..a88b27ba02 100644
--- a/src/components/views/dialogs/ChatInviteDialog.js
+++ b/src/components/views/dialogs/ChatInviteDialog.js
@@ -73,7 +73,7 @@ module.exports = React.createClass({
// Either an address tile was created, or text input is being used
if (this.state.inviteList[0]) {
- addr = this.state.inviteList[0].userId;
+ addr = this.state.inviteList[0];
} else {
addr = this.refs.textinput.value;
}
@@ -159,7 +159,7 @@ module.exports = React.createClass({
onSelected: function(index) {
var inviteList = this.state.inviteList.slice();
- inviteList.push(this.state.queryList[index]);
+ inviteList.push(this.state.queryList[index].userId.toLowerCase());
this.setState({
inviteList: inviteList,
queryList: [],
@@ -238,7 +238,7 @@ module.exports = React.createClass({
_isOnInviteList: function(uid) {
for (let i = 0; i < this.state.inviteList.length; i++) {
- if (this.state.inviteList[i].userId.toLowerCase() === uid) {
+ if (this.state.inviteList[i] === uid) {
return true;
}
}
@@ -256,7 +256,7 @@ module.exports = React.createClass({
var AddressTile = sdk.getComponent("elements.AddressTile");
for (let i = 0; i < this.state.inviteList.length; i++) {
query.push(
-
+
);
}
}
diff --git a/src/components/views/elements/AddressSelector.js b/src/components/views/elements/AddressSelector.js
index 7668cca537..204e08404e 100644
--- a/src/components/views/elements/AddressSelector.js
+++ b/src/components/views/elements/AddressSelector.js
@@ -125,7 +125,7 @@ module.exports = React.createClass({
// method, how far to scroll when using the arrow keys
addressList.push(
{ this.addressListElement = ref; }} >
-
+
);
}
diff --git a/src/components/views/elements/AddressTile.js b/src/components/views/elements/AddressTile.js
index e0a5dbbc80..a5223fb21c 100644
--- a/src/components/views/elements/AddressTile.js
+++ b/src/components/views/elements/AddressTile.js
@@ -19,13 +19,15 @@ limitations under the License.
var React = require('react');
var classNames = require('classnames');
var sdk = require("../../../index");
+var Invite = require("../../../Invite");
+var MatrixClientPeg = require("../../../MatrixClientPeg");
var Avatar = require('../../../Avatar');
module.exports = React.createClass({
displayName: 'AddressTile',
propTypes: {
- user: React.PropTypes.object.isRequired,
+ address: React.PropTypes.string.isRequired,
canDismiss: React.PropTypes.bool,
onDismissed: React.PropTypes.func,
justified: React.PropTypes.bool,
@@ -44,11 +46,27 @@ module.exports = React.createClass({
},
render: function() {
+ var userId, name, imgUrl, email;
var BaseAvatar = sdk.getComponent('avatars.BaseAvatar');
var TintableSvg = sdk.getComponent("elements.TintableSvg");
- var userId = this.props.user.userId;
- var name = this.props.user.displayName || userId;
- var imgUrl = Avatar.avatarUrlForUser(this.props.user, 25, 25, "crop");
+
+ // Check if the addr is a valid type
+ var addrType = Invite.getAddressType(this.props.address);
+ if (addrType === "mx") {
+ let user = MatrixClientPeg.get().getUser(this.props.address);
+ if (user) {
+ userId = user.userId;
+ name = user.displayName || userId;
+ imgUrl = Avatar.avatarUrlForUser(user, 25, 25, "crop");
+ }
+ } else if (addrType === "email") {
+ email = this.props.address;
+ name="email";
+ imgUrl = "img/icon-email-user.svg";
+ } else {
+ name="Unknown";
+ imgUrl = "img/icon-email-user.svg";
+ }
var network;
if (this.props.networkUrl !== "") {
@@ -59,6 +77,44 @@ module.exports = React.createClass({
);
}
+ var info;
+ if (userId) {
+ var nameClasses = classNames({
+ "mx_AddressTile_name": true,
+ "mx_AddressTile_justified": this.props.justified,
+ });
+
+ var idClasses = classNames({
+ "mx_AddressTile_id": true,
+ "mx_AddressTile_justified": this.props.justified,
+ });
+
+ info = (
+
+
{ name }
+
{ userId }
+
+ );
+ } else if (email) {
+ var emailClasses = classNames({
+ "mx_AddressTile_email": true,
+ "mx_AddressTile_justified": this.props.justified,
+ });
+
+ info = (
+ { email }
+ );
+ } else {
+ var unknownClasses = classNames({
+ "mx_AddressTile_unknown": true,
+ "mx_AddressTile_justified": this.props.justified,
+ });
+
+ info = (
+ Unknown Address
+ );
+ }
+
var dismiss;
if (this.props.canDismiss) {
dismiss = (
@@ -68,24 +124,13 @@ module.exports = React.createClass({
);
}
- var nameClasses = classNames({
- "mx_AddressTile_name": true,
- "mx_AddressTile_justified": this.props.justified,
- });
-
- var idClasses = classNames({
- "mx_AddressTile_id": true,
- "mx_AddressTile_justified": this.props.justified,
- });
-
return (
{ network }
-
{ name }
-
{ userId }
+ { info }
{ dismiss }
);