fix: react to contact name (nickname) changes

the contact details are fetched imperatively in these popups (not via
model updates), so we need to setup a signal to be able to react to those
changes
This commit is contained in:
Lukáš Tinkl 2023-04-19 18:28:23 +02:00 committed by Lukáš Tinkl
parent 691de11211
commit 297b73fced
4 changed files with 20 additions and 0 deletions

View File

@ -362,6 +362,7 @@ QtObject {
onEditDone: { onEditDone: {
if (nickname !== newNickname) { if (nickname !== newNickname) {
rootStore.contactStore.changeContactNickname(publicKey, newNickname) rootStore.contactStore.changeContactNickname(publicKey, newNickname)
Global.contactRenamed(publicKey)
} }
close() close()
} }

View File

@ -61,6 +61,15 @@ ActivityNotificationBase {
} }
} }
Connections {
target: Global
function onContactRenamed(pubKey) {
if (pubKey === root.contactId)
root.updateContactDetails()
}
}
bodyComponent: MouseArea { bodyComponent: MouseArea {
implicitWidth: parent.width implicitWidth: parent.width
implicitHeight: messageView.implicitHeight implicitHeight: messageView.implicitHeight

View File

@ -122,6 +122,15 @@ Pane {
} }
} }
readonly property var conns4: Connections {
target: Global
function onContactRenamed(pubKey) {
if (pubKey === root.publicKey)
d.reload()
}
}
readonly property var timer: Timer { readonly property var timer: Timer {
id: timer id: timer
} }

View File

@ -41,6 +41,7 @@ QtObject {
signal openInviteFriendsToCommunityPopup(var community, var communitySectionModule, var cb) signal openInviteFriendsToCommunityPopup(var community, var communitySectionModule, var cb)
signal openIncomingIDRequestPopup(string publicKey, var cb) signal openIncomingIDRequestPopup(string publicKey, var cb)
signal openOutgoingIDRequestPopup(string publicKey, var cb) signal openOutgoingIDRequestPopup(string publicKey, var cb)
signal contactRenamed(string publicKey)
signal openLink(string link) signal openLink(string link)