fix(Profile flow): ID verification cannot be removed (#14308)
fix(UserListPanel): hide the verification icon for yourself fixes #13619 * split function for reseting trust status and verification+trust status * rename function to removeTrustVerificationStatus
This commit is contained in:
parent
173a02f1fc
commit
b5dbac2e74
|
@ -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,
|
||||
|
|
|
@ -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)
|
||||
|
||||
|
|
|
@ -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")
|
||||
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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)
|
||||
|
||||
|
|
|
@ -714,18 +714,30 @@ QtObject:
|
|||
error "error verified untrustworthy request", msg=e.msg
|
||||
|
||||
proc removeTrustStatus*(self: Service, publicKey: string) =
|
||||
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:
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
|
|
|
@ -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"))
|
||||
|
|
|
@ -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))
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit 12deb2336028639ff11b6a3e08043e2961bed5c4
|
||||
Subproject commit 78db9054fc4fac565f5fb6cdd711d22e5870d0a1
|
Loading…
Reference in New Issue