merge chat list and found contacts
This commit is contained in:
+8
-4
@@ -4714,14 +4714,18 @@ class TinodeWeb extends React.Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
tnFndSubsUpdated() {
|
tnFndSubsUpdated() {
|
||||||
let contacts = [];
|
let foundContacts = [];
|
||||||
// Don't attempt to create P2P topics which already exist. Server will reject the duplicates.
|
// Don't attempt to create P2P topics which already exist. Server will reject the duplicates.
|
||||||
this.state.tinode.getFndTopic().contacts((s) => {
|
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({
|
this.setState({
|
||||||
searchResults: contacts,
|
searchResults: foundContacts,
|
||||||
searchableContacts: mergeContacts(contacts, this.state.chatList)
|
searchableContacts: Object.values(merged)
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user