take into account the addressType also
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
This commit is contained in:
parent
4040e3f5cf
commit
fd252ded60
1 changed files with 10 additions and 3 deletions
|
@ -517,9 +517,16 @@ module.exports = React.createClass({
|
||||||
const AddressSelector = sdk.getComponent("elements.AddressSelector");
|
const AddressSelector = sdk.getComponent("elements.AddressSelector");
|
||||||
this.scrollElement = null;
|
this.scrollElement = null;
|
||||||
|
|
||||||
// Use set to avoid O(n*m) operation
|
// map addressType => set of addresses to avoid O(n*m) operation
|
||||||
const selectedAddresses = new Set(this.state.userList.map(({address}) => address));
|
const selectedAddresses = {};
|
||||||
const queryList = this.state.queryList.filter(({address}) => !selectedAddresses.has(address));
|
this.state.userList.forEach(({address, addressType}) => {
|
||||||
|
if (!selectedAddresses[addressType]) selectedAddresses[addressType] = new Set();
|
||||||
|
selectedAddresses[addressType].add(address);
|
||||||
|
});
|
||||||
|
|
||||||
|
const queryList = this.state.queryList.filter(({address, addressType}) => {
|
||||||
|
return !selectedAddresses[addressType] || !selectedAddresses[addressType].has(address);
|
||||||
|
});
|
||||||
|
|
||||||
const query = [];
|
const query = [];
|
||||||
// create the invite list
|
// create the invite list
|
||||||
|
|
Loading…
Reference in a new issue