diff --git a/src/app/modules/main/profile_section/contacts/controller.nim b/src/app/modules/main/profile_section/contacts/controller.nim index 103ef6201f..7887fd041c 100644 --- a/src/app/modules/main/profile_section/contacts/controller.nim +++ b/src/app/modules/main/profile_section/contacts/controller.nim @@ -64,6 +64,7 @@ proc init*(self: Controller) = self.events.on(SIGNAL_REMOVED_TRUST_STATUS) do(e: Args): var args = TrustArgs(e) self.delegate.contactTrustStatusChanged(args.publicKey, args.trustStatus) + self.delegate.onTrustStatusRemoved(args.publicKey) self.events.on(SIGNAL_CONTACT_UPDATED) do(e: Args): var args = ContactArgs(e) @@ -160,4 +161,4 @@ proc fetchProfileShowcaseAccountsByAddress*(self: Controller, address: string) = self.contactsService.fetchProfileShowcaseAccountsByAddress(address) proc getEnabledChainIds*(self: Controller): seq[int] = - return self.networkService.getEnabledChainIds() \ No newline at end of file + return self.networkService.getEnabledChainIds() diff --git a/src/app/modules/main/profile_section/contacts/io_interface.nim b/src/app/modules/main/profile_section/contacts/io_interface.nim index 9eabd2f89f..51ad181104 100644 --- a/src/app/modules/main/profile_section/contacts/io_interface.nim +++ b/src/app/modules/main/profile_section/contacts/io_interface.nim @@ -71,6 +71,9 @@ method contactNicknameChanged*(self: AccessInterface, publicKey: string) {.base. method contactTrustStatusChanged*(self: AccessInterface, publicKey: string, trustStatus: TrustStatus) {.base.} = raise newException(ValueError, "No implementation available") +method onTrustStatusRemoved*(self: AccessInterface, publicKey: string): void {.base.} = + raise newException(ValueError, "No implementation available") + method contactsStatusUpdated*(self: AccessInterface, statusUpdates: seq[StatusUpdateDto]) {.base.} = raise newException(ValueError, "No implementation available") @@ -117,4 +120,4 @@ method getShowcaseCollectiblesModel*(self: AccessInterface): QVariant {.base.} = raise newException(ValueError, "No implementation available") method isShowcaseForAContactLoading*(self: AccessInterface): bool {.base.} = - raise newException(ValueError, "No implementation available") \ No newline at end of file + raise newException(ValueError, "No implementation available") diff --git a/src/app/modules/main/profile_section/contacts/module.nim b/src/app/modules/main/profile_section/contacts/module.nim index 24603541a3..ed3744a94e 100644 --- a/src/app/modules/main/profile_section/contacts/module.nim +++ b/src/app/modules/main/profile_section/contacts/module.nim @@ -203,6 +203,9 @@ method contactNicknameChanged*(self: Module, publicKey: string) = method contactTrustStatusChanged*(self: Module, publicKey: string, trustStatus: TrustStatus) = self.view.contactsModel().updateTrustStatus(publicKey, trustStatus) +method onTrustStatusRemoved(self: Module, publicKey: string) = + self.view.trustStatusRemoved(publicKey) + method markAsTrusted*(self: Module, publicKey: string): void = self.controller.markAsTrusted(publicKey) diff --git a/src/app/modules/main/profile_section/contacts/view.nim b/src/app/modules/main/profile_section/contacts/view.nim index 39757679d2..44c1106ff4 100644 --- a/src/app/modules/main/profile_section/contacts/view.nim +++ b/src/app/modules/main/profile_section/contacts/view.nim @@ -108,6 +108,8 @@ QtObject: proc removeTrustStatus*(self: View, publicKey: string) {.slot.} = self.delegate.removeTrustStatus(publicKey) + proc trustStatusRemoved*(self: View, publicKey: string) {.signal.} + proc shareUserUrlWithData*(self: View, pubkey: string): string {.slot.} = return self.delegate.shareUserUrlWithData(pubkey) diff --git a/ui/app/AppLayouts/Chat/panels/UserListPanel.qml b/ui/app/AppLayouts/Chat/panels/UserListPanel.qml index e69e46648c..3eff6604af 100644 --- a/ui/app/AppLayouts/Chat/panels/UserListPanel.qml +++ b/ui/app/AppLayouts/Chat/panels/UserListPanel.qml @@ -148,7 +148,7 @@ Item { emojiHash: model.emojiHash, colorHash: model.colorHash, colorId: model.colorId, - displayName: nickName || userName, + displayName: model.preferredDisplayName, userIcon: model.icon, trustStatus: model.trustStatus, onlineStatus: model.onlineStatus, diff --git a/ui/app/AppLayouts/Profile/stores/ContactsStore.qml b/ui/app/AppLayouts/Profile/stores/ContactsStore.qml index b318492d78..0f219aca1b 100644 --- a/ui/app/AppLayouts/Profile/stores/ContactsStore.qml +++ b/ui/app/AppLayouts/Profile/stores/ContactsStore.qml @@ -1,6 +1,8 @@ import QtQuick 2.15 import StatusQ 0.1 +import StatusQ.Core.Utils 0.1 as SQUtils + import utils 1.0 QtObject { @@ -15,6 +17,7 @@ QtObject { Component.onCompleted: { mainModuleInst.resolvedENS.connect(root.resolvedENS) + contactsModuleInst.trustStatusRemoved.connect(root.trustStatusRemoved) } } @@ -38,6 +41,7 @@ QtObject { readonly property var showcaseCollectiblesModel: d.contactsModuleInst.showcaseCollectiblesModel signal resolvedENS(string resolvedPubKey, string resolvedAddress, string uuid) + signal trustStatusRemoved(string pubKey) // Sets showcasePublicKey and updates showcase models with corresponding data function requestProfileShowcase(publicKey) { diff --git a/ui/app/mainui/Popups.qml b/ui/app/mainui/Popups.qml index 099587fd04..fe106fce16 100644 --- a/ui/app/mainui/Popups.qml +++ b/ui/app/mainui/Popups.qml @@ -458,8 +458,6 @@ QtObject { utilsStore: root.utilsStore onAccepted: { - rootStore.contactStore.removeTrustStatus(publicKey) - if (markAsUntrusted && removeContact) { rootStore.contactStore.markUntrustworthy(publicKey) rootStore.contactStore.removeContact(publicKey) @@ -471,7 +469,7 @@ QtObject { rootStore.contactStore.removeContact(publicKey) Global.displaySuccessToastMessage(qsTr("%1 trust mark removed and removed from contacts").arg(mainDisplayName)) } else { - Global.displaySuccessToastMessage(qsTr("%1 trust mark removed").arg(mainDisplayName)) + rootStore.contactStore.removeTrustStatus(publicKey) } close() } diff --git a/ui/app/mainui/ToastsManager.qml b/ui/app/mainui/ToastsManager.qml index 76ce244f86..1badca2325 100644 --- a/ui/app/mainui/ToastsManager.qml +++ b/ui/app/mainui/ToastsManager.qml @@ -1,5 +1,7 @@ import QtQuick 2.15 +import StatusQ.Core.Utils 0.1 as SQUtils + import utils 1.0 import AppLayouts.Wallet 1.0 @@ -230,6 +232,15 @@ QtObject { } } + readonly property Connections _contactStoreConnections: Connections { + target: root.rootStore.contactStore + + function onTrustStatusRemoved(pubKey: string) { + const displayName = SQUtils.ModelUtils.getByKey(root.rootStore.contactStore.contactsModel, "pubKey", pubKey, "preferredDisplayName") + Global.displaySuccessToastMessage(qsTr("Trust mark removed for %1").arg(displayName)) + } + } + // It will cover all specific actions (different than open external links) that can be done after clicking toast link text function doAction(actionType, actionData) { switch(actionType) {