diff --git a/src/Invite.js b/src/Invite.js index 678a838bf1..6422812734 100644 --- a/src/Invite.js +++ b/src/Invite.js @@ -59,6 +59,12 @@ export function inviteMultipleToRoom(roomId, addrs) { return this.inviter.invite(addrs); } +/** + * Checks is the supplied address is valid + * + * @param {addr} The mx userId or email address to check + * @returns true, false, or null for unsure + */ export function isValidAddress(addr) { // Check if the addr is a valid type var addrType = this.getAddressType(addr); @@ -67,7 +73,7 @@ export function isValidAddress(addr) { if (user) { return true; } else { - return false; + return null; } } else if (addrType === "email") { return true; diff --git a/src/components/views/dialogs/ChatInviteDialog.js b/src/components/views/dialogs/ChatInviteDialog.js index a2471092d0..7f04986b6b 100644 --- a/src/components/views/dialogs/ChatInviteDialog.js +++ b/src/components/views/dialogs/ChatInviteDialog.js @@ -120,7 +120,8 @@ module.exports = React.createClass({ } else if (e.keyCode === 32 || e.keyCode === 188) { // space or comma e.stopPropagation(); e.preventDefault(); - if (Invite.isValidAddress(this.refs.textinput.value)) { + var check = Invite.isValidAddress(this.refs.textinput.value); + if (check === true || check === null) { var inviteList = this.state.inviteList.slice(); inviteList.push(this.refs.textinput.value); this.setState({ diff --git a/src/components/views/elements/AddressTile.js b/src/components/views/elements/AddressTile.js index a6b86c12b2..f81bb3dff0 100644 --- a/src/components/views/elements/AddressTile.js +++ b/src/components/views/elements/AddressTile.js @@ -59,8 +59,8 @@ module.exports = React.createClass({ name = user.displayName || userId; imgUrl = Avatar.avatarUrlForUser(user, 25, 25, "crop"); } else { - name="Unknown"; - imgUrl = "img/avatar-error.svg"; + name=this.props.address; + imgUrl = "img/icon-mx-user.svg"; } } else if (addrType === "email") { email = this.props.address; @@ -82,7 +82,7 @@ module.exports = React.createClass({ var info; var error = false; - if (userId) { + if (addrType === "mx" && userId) { var nameClasses = classNames({ "mx_AddressTile_name": true, "mx_AddressTile_justified": this.props.justified, @@ -99,6 +99,15 @@ module.exports = React.createClass({
{ userId }
); + } else if (addrType === "mx") { + var unknownMxClasses = classNames({ + "mx_AddressTile_unknownMx": true, + "mx_AddressTile_justified": this.props.justified, + }); + + info = ( +
{ this.props.address }
+ ); } else if (email) { var emailClasses = classNames({ "mx_AddressTile_email": true,