Added valid but unknown mx user
This commit is contained in:
parent
890100a5bc
commit
7fa102998c
3 changed files with 21 additions and 5 deletions
|
@ -59,6 +59,12 @@ export function inviteMultipleToRoom(roomId, addrs) {
|
||||||
return this.inviter.invite(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) {
|
export function isValidAddress(addr) {
|
||||||
// Check if the addr is a valid type
|
// Check if the addr is a valid type
|
||||||
var addrType = this.getAddressType(addr);
|
var addrType = this.getAddressType(addr);
|
||||||
|
@ -67,7 +73,7 @@ export function isValidAddress(addr) {
|
||||||
if (user) {
|
if (user) {
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return null;
|
||||||
}
|
}
|
||||||
} else if (addrType === "email") {
|
} else if (addrType === "email") {
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -120,7 +120,8 @@ module.exports = React.createClass({
|
||||||
} else if (e.keyCode === 32 || e.keyCode === 188) { // space or comma
|
} else if (e.keyCode === 32 || e.keyCode === 188) { // space or comma
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
e.preventDefault();
|
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();
|
var inviteList = this.state.inviteList.slice();
|
||||||
inviteList.push(this.refs.textinput.value);
|
inviteList.push(this.refs.textinput.value);
|
||||||
this.setState({
|
this.setState({
|
||||||
|
|
|
@ -59,8 +59,8 @@ module.exports = React.createClass({
|
||||||
name = user.displayName || userId;
|
name = user.displayName || userId;
|
||||||
imgUrl = Avatar.avatarUrlForUser(user, 25, 25, "crop");
|
imgUrl = Avatar.avatarUrlForUser(user, 25, 25, "crop");
|
||||||
} else {
|
} else {
|
||||||
name="Unknown";
|
name=this.props.address;
|
||||||
imgUrl = "img/avatar-error.svg";
|
imgUrl = "img/icon-mx-user.svg";
|
||||||
}
|
}
|
||||||
} else if (addrType === "email") {
|
} else if (addrType === "email") {
|
||||||
email = this.props.address;
|
email = this.props.address;
|
||||||
|
@ -82,7 +82,7 @@ module.exports = React.createClass({
|
||||||
|
|
||||||
var info;
|
var info;
|
||||||
var error = false;
|
var error = false;
|
||||||
if (userId) {
|
if (addrType === "mx" && userId) {
|
||||||
var nameClasses = classNames({
|
var nameClasses = classNames({
|
||||||
"mx_AddressTile_name": true,
|
"mx_AddressTile_name": true,
|
||||||
"mx_AddressTile_justified": this.props.justified,
|
"mx_AddressTile_justified": this.props.justified,
|
||||||
|
@ -99,6 +99,15 @@ module.exports = React.createClass({
|
||||||
<div className={idClasses}>{ userId }</div>
|
<div className={idClasses}>{ userId }</div>
|
||||||
</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) {
|
} else if (email) {
|
||||||
var emailClasses = classNames({
|
var emailClasses = classNames({
|
||||||
"mx_AddressTile_email": true,
|
"mx_AddressTile_email": true,
|
||||||
|
|
Loading…
Reference in a new issue