fix(ActivityCenter): Update AC notification on contact changes

Close #8586
This commit is contained in:
MishkaRogachev 2022-12-30 13:08:25 +04:00 committed by Mikhail Rogachev
parent 130a5f48b4
commit c50cf988a7
3 changed files with 36 additions and 1 deletions

View File

@ -19,6 +19,16 @@ ActivityNotificationMessage {
readonly property bool accepted: notification && notification.message.contactRequestState === Constants.contactRequestStateAccepted
readonly property bool dismissed: notification && notification.message.contactRequestState === Constants.contactRequestStateDismissed
Connections {
target: root.isOutgoingRequest ? root.store.contactsStore.sentContactRequestsModel :
root.store.contactsStore.receivedContactRequestsModel
function onItemChanged(pubKey) {
if (pubKey === root.contactId)
root.updateContactDetails()
}
}
maximumLineCount: 5
messageDetails.messageText: {
if (isOutgoingRequest && contactDetails) {

View File

@ -15,6 +15,16 @@ import "../panels"
ActivityNotificationMessage {
id: root
Connections {
target: root.isOutgoingRequest ? root.store.contactsStore.sentContactRequestsModel :
root.store.contactsStore.receivedContactRequestsModel
function onItemChanged(pubKey) {
if (pubKey === root.contactId)
root.updateContactDetails()
}
}
messageDetails.messageText: {
if (!notification)
return ""

View File

@ -18,8 +18,8 @@ ActivityNotificationBase {
new Date(notification.timestamp).toLocaleString() : ""
readonly property bool isOutgoingRequest: notification && notification.message.amISender
readonly property string contactId: notification ? isOutgoingRequest ? notification.chatId : notification.author : ""
readonly property var contactDetails: notification ? Utils.getContactDetailsAsJson(contactId, false) : null
property var contactDetails: null
property int maximumLineCount: 2
signal messageClicked()
@ -50,6 +50,21 @@ ActivityNotificationBase {
Global.openProfilePopup(contactId)
}
function updateContactDetails() {
contactDetails = notification ? Utils.getContactDetailsAsJson(contactId, false) : null
}
onContactIdChanged: root.updateContactDetails()
Connections {
target: root.store.contactsStore.myContactsModel
function onItemChanged(pubKey) {
if (pubKey === root.contactId)
root.updateContactDetails()
}
}
bodyComponent: MouseArea {
height: messageRow.implicitHeight
hoverEnabled: root.messageBadgeComponent