From 325d3588d3754c1be39b443225b654089825f7da Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Cie=C5=9Blak?= Date: Wed, 13 Nov 2024 17:46:45 +0100 Subject: [PATCH] ActivityNotificationMessage/Chat.RootStore: remove dependency on nim model's onItemChanged signal Closes: #16754 --- ui/app/AppLayouts/Chat/stores/RootStore.qml | 16 ++++++---------- .../views/ActivityNotificationMessage.qml | 11 +++++------ 2 files changed, 11 insertions(+), 16 deletions(-) diff --git a/ui/app/AppLayouts/Chat/stores/RootStore.qml b/ui/app/AppLayouts/Chat/stores/RootStore.qml index b86b58cf25a..a0abf76f041 100644 --- a/ui/app/AppLayouts/Chat/stores/RootStore.qml +++ b/ui/app/AppLayouts/Chat/stores/RootStore.qml @@ -640,7 +640,7 @@ QtObject { } } - readonly property QtObject _d: QtObject { + readonly property QtObject _d: StatusQUtils.QObject { id: d readonly property var userProfileInst: userProfile @@ -675,16 +675,12 @@ QtObject { d.oneToOneChatContact.displayName, d.oneToOneChatContact.alias) : "" - //Update oneToOneChatContact when the contact is updated - readonly property var myContactsModelConnection: Connections { - target: root.contactsStore.contactsModel ?? null - enabled: d.activeChatType === Constants.chatType.oneToOne + StatusQUtils.ModelEntryChangeTracker { + model: root.contactsStore.contactsModel + role: "pubKey" + key: d.activeChatId - function onItemChanged(pubKey) { - if (pubKey === d.activeChatId) { - d.oneToOneChatContact = Utils.getContactDetailsAsJson(pubKey, false) - } - } + onItemChanged: d.oneToOneChatContact = Utils.getContactDetailsAsJson(d.activeChatId, false) } readonly property bool isUserAllowedToSendMessage: { diff --git a/ui/app/mainui/activitycenter/views/ActivityNotificationMessage.qml b/ui/app/mainui/activitycenter/views/ActivityNotificationMessage.qml index 51551159775..a5bfe01a0f1 100644 --- a/ui/app/mainui/activitycenter/views/ActivityNotificationMessage.qml +++ b/ui/app/mainui/activitycenter/views/ActivityNotificationMessage.qml @@ -61,13 +61,12 @@ ActivityNotificationBase { onContactIdChanged: root.updateContactDetails() - Connections { - target: root.store.contactsStore.contactsModel + CoreUtils.ModelEntryChangeTracker { + model: root.store.contactsStore.contactsModel + role: "pubKey" + key: root.contactId - function onItemChanged(pubKey) { - if (pubKey === root.contactId) - root.updateContactDetails() - } + onItemChanged: root.updateContactDetails() } bodyComponent: MouseArea {