Don't allow someone who is already on the invite list to appear in the AddressSelector

This commit is contained in:
wmwragg 2016-09-12 15:48:32 +01:00
parent 4836025a1d
commit e28a3f10a0

View file

@ -211,6 +211,11 @@ module.exports = React.createClass({
var uid = user.userId.toLowerCase();
query = query.toLowerCase();
// dount match any that are already on the invite list
if (this._isOnInviteList(uid)) {
return false;
}
// direct prefix matches
if (name.indexOf(query) === 0 || uid.indexOf(query) === 0) {
return true;
@ -231,6 +236,15 @@ module.exports = React.createClass({
return false;
},
_isOnInviteList: function(uid) {
for (let i = 0; i < this.state.inviteList.length; i++) {
if (this.state.inviteList[i].userId.toLowerCase() === uid) {
return true;
}
}
return false;
},
render: function() {
var TintableSvg = sdk.getComponent("elements.TintableSvg");
var AddressSelector = sdk.getComponent("elements.AddressSelector");