diff --git a/src/app/modules/main/chat_section/chat_content/users/module.nim b/src/app/modules/main/chat_section/chat_content/users/module.nim index 2f46a6d521..aa38c842ec 100644 --- a/src/app/modules/main/chat_section/chat_content/users/module.nim +++ b/src/app/modules/main/chat_section/chat_content/users/module.nim @@ -75,6 +75,7 @@ method contactsStatusUpdated*(self: Module, statusUpdates: seq[StatusUpdateDto]) method contactUpdated*(self: Module, publicKey: string) = let contactDetails = self.controller.getContactDetails(publicKey) + let isMe = publicKey == singletonInstance.userProfile.getPubKey() self.view.model().updateItem( pubKey = publicKey, displayName = contactDetails.dto.displayName, @@ -84,7 +85,7 @@ method contactUpdated*(self: Module, publicKey: string) = alias = contactDetails.dto.alias, icon = contactDetails.icon, isContact = contactDetails.dto.isContact, - isVerified = contactDetails.dto.isContactVerified(), + isVerified = not isMe and contactDetails.dto.isContactVerified(), isUntrustworthy = contactDetails.dto.trustStatus == TrustStatus.Untrustworthy, ) @@ -129,7 +130,7 @@ proc addChatMember(self: Module, member: ChatMember) = colorHash = contactDetails.colorHash, onlineStatus = status, isContact = contactDetails.dto.isContact, - isVerified = contactDetails.dto.isContactVerified(), + isVerified = not isMe and contactDetails.dto.isContactVerified(), memberRole = member.role, joined = member.joined, isUntrustworthy = contactDetails.dto.trustStatus == TrustStatus.Untrustworthy, @@ -156,6 +157,7 @@ method onMembersChanged*(self: Module, members: seq[ChatMember]) = method onChatMemberUpdated*(self: Module, publicKey: string, memberRole: MemberRole, joined: bool) = let contactDetails = self.controller.getContactDetails(publicKey) + let isMe = publicKey == singletonInstance.userProfile.getPubKey() self.view.model().updateItem( pubKey = publicKey, displayName = contactDetails.dto.displayName, @@ -165,7 +167,7 @@ method onChatMemberUpdated*(self: Module, publicKey: string, memberRole: MemberR alias = contactDetails.dto.alias, icon = contactDetails.icon, isContact = contactDetails.dto.isContact, - isVerified = contactDetails.dto.isContactVerified(), + isVerified = not isMe and contactDetails.dto.isContactVerified(), memberRole = memberRole, joined = joined, isUntrustworthy = contactDetails.dto.trustStatus == TrustStatus.Untrustworthy, diff --git a/src/app/modules/main/profile_section/contacts/controller.nim b/src/app/modules/main/profile_section/contacts/controller.nim index cc08579f9b..e0aea92887 100644 --- a/src/app/modules/main/profile_section/contacts/controller.nim +++ b/src/app/modules/main/profile_section/contacts/controller.nim @@ -168,6 +168,9 @@ proc sendVerificationRequest*(self: Controller, publicKey: string, challenge: st proc cancelVerificationRequest*(self: Controller, publicKey: string) = self.contactsService.cancelVerificationRequest(publicKey) +proc removeTrustVerificationStatus*(self: Controller, publicKey: string) = + self.contactsService.removeTrustVerificationStatus(publicKey) + proc verifiedTrusted*(self: Controller, publicKey: string) = self.contactsService.verifiedTrusted(publicKey) 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 49073876af..a835e04d9b 100644 --- a/src/app/modules/main/profile_section/contacts/io_interface.nim +++ b/src/app/modules/main/profile_section/contacts/io_interface.nim @@ -91,6 +91,9 @@ method markUntrustworthy*(self: AccessInterface, publicKey: string): void {.base method removeTrustStatus*(self: AccessInterface, publicKey: string): void {.base.} = raise newException(ValueError, "No implementation available") +method removeTrustVerificationStatus*(self: AccessInterface, publicKey: string): void {.base.} = + raise newException(ValueError, "No implementation available") + method getSentVerificationDetailsAsJson*(self: AccessInterface, publicKey: string): string {.base.} = 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 65b86903fe..e1239f82f2 100644 --- a/src/app/modules/main/profile_section/contacts/module.nim +++ b/src/app/modules/main/profile_section/contacts/module.nim @@ -245,6 +245,9 @@ method markUntrustworthy*(self: Module, publicKey: string): void = method removeTrustStatus*(self: Module, publicKey: string): void = self.controller.removeTrustStatus(publicKey) +method removeTrustVerificationStatus*(self: Module, publicKey: string): void = + self.controller.removeTrustVerificationStatus(publicKey) + method getSentVerificationDetailsAsJson*(self: Module, publicKey: string): string = let verificationRequest = self.controller.getVerificationRequestSentTo(publicKey) let (name, image, largeImage) = self.controller.getContactNameAndImage(publicKey) diff --git a/src/app/modules/main/profile_section/contacts/view.nim b/src/app/modules/main/profile_section/contacts/view.nim index b56f188e22..9fb7bcb38d 100644 --- a/src/app/modules/main/profile_section/contacts/view.nim +++ b/src/app/modules/main/profile_section/contacts/view.nim @@ -202,6 +202,9 @@ QtObject: proc removeTrustStatus*(self: View, publicKey: string) {.slot.} = self.delegate.removeTrustStatus(publicKey) + proc removeTrustVerificationStatus*(self: View, publicKey: string) {.slot.} = + self.delegate.removeTrustVerificationStatus(publicKey) + proc getSentVerificationDetailsAsJson(self: View, publicKey: string): string {.slot.} = return self.delegate.getSentVerificationDetailsAsJson(publicKey) diff --git a/src/app_service/service/contacts/service.nim b/src/app_service/service/contacts/service.nim index 9f5518f02b..0a9c4f79dc 100644 --- a/src/app_service/service/contacts/service.nim +++ b/src/app_service/service/contacts/service.nim @@ -714,18 +714,30 @@ QtObject: error "error verified untrustworthy request", msg=e.msg proc removeTrustStatus*(self: Service, publicKey: string) = - let response = status_contacts.removeTrustStatus(publicKey) - if not response.error.isNil: - error "error removing trust status", msg = response.error.message - return + try: + let response = status_contacts.removeTrustStatus(publicKey) + if not response.error.isNil: + error "error removing trust status", msg = response.error.message + return - if self.contacts.hasKey(publicKey): - self.contacts[publicKey].dto.trustStatus = TrustStatus.Unknown - if self.contacts[publicKey].dto.verificationStatus == VerificationStatus.Verified: - self.contacts[publicKey].dto.verificationStatus = VerificationStatus.Unverified + self.parseContactsResponse(response) + self.parseContactsResponse(response) + self.events.emit(SIGNAL_REMOVED_TRUST_STATUS, TrustArgs(publicKey: publicKey, isUntrustworthy: false)) + except Exception as e: + error "error in removeTrustStatus request", msg = e.msg - self.events.emit(SIGNAL_REMOVED_TRUST_STATUS, - TrustArgs(publicKey: publicKey, isUntrustworthy: false)) + proc removeTrustVerificationStatus*(self: Service, publicKey: string) = + try: + let response = status_contacts.removeTrustVerificationStatus(publicKey) + if not response.error.isNil: + error "error removing trust status", msg = response.error.message + return + + self.parseContactsResponse(response) + self.events.emit(SIGNAL_REMOVED_TRUST_STATUS, TrustArgs(publicKey: publicKey, isUntrustworthy: false)) + self.events.emit(SIGNAL_CONTACT_VERIFIED, ContactArgs(contactId: publicKey)) + except Exception as e: + error "error removeTrustVerificationStatus request", msg = e.msg proc getVerificationRequestSentTo*(self: Service, publicKey: string): VerificationRequest = try: diff --git a/src/backend/contacts.nim b/src/backend/contacts.nim index 507eadc731..3b77b9a858 100644 --- a/src/backend/contacts.nim +++ b/src/backend/contacts.nim @@ -95,6 +95,10 @@ proc removeTrustStatus*(pubkey: string): RpcResponse[JsonNode] = let payload = %* [pubkey] result = callPrivateRPC("removeTrustStatus".prefix, payload) +proc removeTrustVerificationStatus*(pubkey: string): RpcResponse[JsonNode] = + let payload = %* [pubkey] + result = callPrivateRPC("removeTrustVerificationStatus".prefix, payload) + proc getTrustStatus*(pubkey: string): RpcResponse[JsonNode] = let payload = %* [pubkey] result = callPrivateRPC("getTrustStatus".prefix, payload) diff --git a/storybook/pages/ProfileDialogViewPage.qml b/storybook/pages/ProfileDialogViewPage.qml index 8946115ae2..4a12ea0ccb 100644 --- a/storybook/pages/ProfileDialogViewPage.qml +++ b/storybook/pages/ProfileDialogViewPage.qml @@ -264,6 +264,13 @@ SplitView { ctrlIncomingVerificationStatus.currentIndex = ctrlIncomingVerificationStatus.indexOfValue(Constants.verificationStatus.unverified) } + function removeTrustVerificationStatus(publicKey) { + logs.logEvent("rootStore::contactStore::removeTrustVerificationStatus", ["publicKey"], arguments) + ctrlTrustStatus.currentIndex = ctrlTrustStatus.indexOfValue(Constants.trustStatus.unknown) + ctrlVerificationStatus.currentIndex = ctrlVerificationStatus.indexOfValue(Constants.verificationStatus.unverified) + ctrlIncomingVerificationStatus.currentIndex = ctrlIncomingVerificationStatus.indexOfValue(Constants.verificationStatus.unverified) + } + function cancelVerificationRequest(pubKey) { logs.logEvent("rootStore::contactStore::cancelVerificationRequest", ["pubKey"], arguments) ctrlVerificationStatus.currentIndex = ctrlVerificationStatus.indexOfValue(Constants.verificationStatus.unverified) @@ -400,6 +407,11 @@ SplitView { ctrlTrustStatus.currentIndex = ctrlTrustStatus.indexOfValue(Constants.trustStatus.unknown) } + function removeTrustVerificationStatus(publicKey) { + logs.logEvent("contactsStore::removeTrustVerificationStatus", ["publicKey"], arguments) + ctrlTrustStatus.currentIndex = ctrlTrustStatus.indexOfValue(Constants.trustStatus.unknown) + } + function verifiedUntrustworthy(publicKey) { logs.logEvent("contactsStore::verifiedUntrustworthy", ["publicKey"], arguments) } diff --git a/ui/app/AppLayouts/Profile/stores/ContactsStore.qml b/ui/app/AppLayouts/Profile/stores/ContactsStore.qml index 87989ee848..1a4e0b095b 100644 --- a/ui/app/AppLayouts/Profile/stores/ContactsStore.qml +++ b/ui/app/AppLayouts/Profile/stores/ContactsStore.qml @@ -127,6 +127,10 @@ QtObject { root.contactsModule.removeTrustStatus(pubKey) } + function removeTrustVerificationStatus(pubKey) { + root.contactsModule.removeTrustVerificationStatus(pubKey) + } + function sendVerificationRequest(pubKey, challenge) { root.contactsModule.sendVerificationRequest(pubKey, challenge); Global.displaySuccessToastMessage(qsTr("ID verification request sent")) diff --git a/ui/app/mainui/Popups.qml b/ui/app/mainui/Popups.qml index c8331074a4..d80c0d0faf 100644 --- a/ui/app/mainui/Popups.qml +++ b/ui/app/mainui/Popups.qml @@ -386,7 +386,7 @@ QtObject { onAccepted: { rootStore.contactStore.removeContact(publicKey) if (removeIDVerification) - rootStore.contactStore.removeTrustStatus(publicKey) + rootStore.contactStore.removeTrustVerificationStatus(publicKey) if (markAsUntrusted) { rootStore.contactStore.markUntrustworthy(publicKey) Global.displaySuccessToastMessage(qsTr("%1 removed from contacts and marked as untrusted").arg(mainDisplayName)) @@ -457,7 +457,7 @@ QtObject { id: removeIDVerificationPopupComponent RemoveIDVerificationDialog { onAccepted: { - rootStore.contactStore.removeTrustStatus(publicKey) + rootStore.contactStore.removeTrustVerificationStatus(publicKey) if (markAsUntrusted && removeContact) { rootStore.contactStore.markUntrustworthy(publicKey) @@ -671,7 +671,7 @@ QtObject { onAccepted: { rootStore.contactStore.blockContact(publicKey) if (removeIDVerification) - rootStore.contactStore.removeTrustStatus(publicKey) + rootStore.contactStore.removeTrustVerificationStatus(publicKey) if (removeContact) rootStore.contactStore.removeContact(publicKey) Global.displaySuccessToastMessage(qsTr("%1 blocked").arg(mainDisplayName)) diff --git a/vendor/status-go b/vendor/status-go index 12deb23360..78db9054fc 160000 --- a/vendor/status-go +++ b/vendor/status-go @@ -1 +1 @@ -Subproject commit 12deb2336028639ff11b6a3e08043e2961bed5c4 +Subproject commit 78db9054fc4fac565f5fb6cdd711d22e5870d0a1