Added valid but unknown mx user

pull/21833/head
wmwragg 2016-09-13 17:09:40 +01:00
parent 890100a5bc
commit 7fa102998c
3 changed files with 21 additions and 5 deletions

View File

@ -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;

View File

@ -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({

View File

@ -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({
<div className={idClasses}>{ userId }</div>
</div>
);
} else if (addrType === "mx") {
var unknownMxClasses = classNames({
"mx_AddressTile_unknownMx": true,
"mx_AddressTile_justified": this.props.justified,
});
info = (
<div className={unknownMxClasses}>{ this.props.address }</div>
);
} else if (email) {
var emailClasses = classNames({
"mx_AddressTile_email": true,