From 0fd31828994c6c66094bc00941a39d38f542162a Mon Sep 17 00:00:00 2001 From: Richard Ramos Date: Sun, 3 Oct 2021 08:38:19 -0400 Subject: [PATCH] refactor: contacts-perfomance --- src/app/profile/views/contact_list.nim | 3 ++- src/app/profile/views/contacts.nim | 11 ++++++----- vendor/status-lib | 2 +- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/src/app/profile/views/contact_list.nim b/src/app/profile/views/contact_list.nim index c78699690a..d85181e52c 100644 --- a/src/app/profile/views/contact_list.nim +++ b/src/app/profile/views/contact_list.nim @@ -138,7 +138,8 @@ QtObject: c.ensName = contact.ensName c.ensVerified = contact.ensVerified c.identityImage = contact.identityImage - c.systemTags = contact.systemTags + c.added = contact.added + c.blocked = contact.blocked if not found: self.addContactToList(contact) diff --git a/src/app/profile/views/contacts.nim b/src/app/profile/views/contacts.nim index e498c16f2f..a1ece3eca0 100644 --- a/src/app/profile/views/contacts.nim +++ b/src/app/profile/views/contacts.nim @@ -82,13 +82,13 @@ QtObject: break self.contactList.updateContact(contact) - if contact.systemTags.contains(contactAdded): + if contact.added: self.addedContacts.updateContact(contact) if contact.isBlocked(): self.blockedContacts.updateContact(contact) - if contact.requestReceived() and not contact.systemTags.contains(contactAdded) and not contact.systemTags.contains(contactBlocked): + if contact.requestReceived() and not contact.added and not contact.blocked: self.contactRequests.updateContact(contact) if not requestAlreadyAdded and contact.requestReceived(): @@ -101,9 +101,10 @@ QtObject: proc setContactList*(self: ContactsView, contactList: seq[Profile]) = self.contactList.setNewData(contactList) - self.addedContacts.setNewData(contactList.filter(c => c.systemTags.contains(contactAdded))) - self.blockedContacts.setNewData(contactList.filter(c => c.systemTags.contains(contactBlocked))) - self.contactRequests.setNewData(contactList.filter(c => c.systemTags.contains(contactRequest) and not c.systemTags.contains(contactAdded) and not c.systemTags.contains(contactBlocked))) + self.addedContacts.setNewData(contactList.filter(c => c.added)) + self.blockedContacts.setNewData(contactList.filter(c => c.blocked)) + self.contactRequests.setNewData(contactList.filter(c => c.hasAddedUs and not c.added and not c.blocked)) + self.contactListChanged() QtProperty[QVariant] list: diff --git a/vendor/status-lib b/vendor/status-lib index 9f88c1b8b4..1ae94006ae 160000 --- a/vendor/status-lib +++ b/vendor/status-lib @@ -1 +1 @@ -Subproject commit 9f88c1b8b45d8fbcf88dc5fec1e0f255f6e1359f +Subproject commit 1ae94006aed9668571ec9a3ee877364786dc47fb