merge chat list and found contacts

This commit is contained in:
or-else
2018-09-11 15:42:05 +03:00
parent 0ba4b85a91
commit ef3d799411
+8 -4
View File
@@ -4714,14 +4714,18 @@ class TinodeWeb extends React.Component {
}
tnFndSubsUpdated() {
let contacts = [];
let foundContacts = [];
// Don't attempt to create P2P topics which already exist. Server will reject the duplicates.
this.state.tinode.getFndTopic().contacts((s) => {
contacts.push(s);
foundContacts.push(s);
});
let merged = {};
for (const c of foundContacts.concat(this.state.chatList)) {
merged[c.topic] = c;
}
this.setState({
searchResults: contacts,
searchableContacts: mergeContacts(contacts, this.state.chatList)
searchResults: foundContacts,
searchableContacts: Object.values(merged)
});
}