fix: removeTrustStatus response processing (#15206)

This commit is contained in:
Igor Sirotin 2024-06-18 11:08:30 +01:00 committed by GitHub
parent 067f406572
commit eb9c629bbf
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 10 additions and 5 deletions

View File

@ -474,9 +474,11 @@ QtObject:
self.events.emit(signal, ContactArgs(contactId: publicKey))
proc parseContactsResponse*(self: Service, response: RpcResponse[JsonNode]) =
if response.result["contacts"] != nil:
for contactJson in response.result["contacts"]:
self.updateContact(contactJson.toContactsDto())
let contacts = response.result{"contacts"}
if contacts == nil:
return
for contactJson in contacts:
self.updateContact(contactJson.toContactsDto())
proc sendContactRequest*(self: Service, publicKey: string, message: string) =
# Prefetch contact to avoid race condition with AC notification
@ -720,7 +722,10 @@ QtObject:
return
self.parseContactsResponse(response)
self.parseContactsResponse(response)
if self.contacts.hasKey(publicKey):
self.contacts[publicKey].dto.trustStatus = TrustStatus.Unknown
self.events.emit(SIGNAL_REMOVED_TRUST_STATUS, TrustArgs(publicKey: publicKey, isUntrustworthy: false))
except Exception as e:
error "error in removeTrustStatus request", msg = e.msg
@ -964,4 +969,4 @@ QtObject:
data.profileShowcase.accounts = map(rpcResponseObj{"response"}.getElems(), proc(x: JsonNode): ProfileShowcaseAccount = toProfileShowcaseAccount(x))
except Exception as e:
error "onProfileShowcaseAccountsByAddressFetched", msg = e.msg
self.events.emit(SIGNAL_CONTACT_SHOWCASE_ACCOUNTS_BY_ADDRESS_FETCHED, data)
self.events.emit(SIGNAL_CONTACT_SHOWCASE_ACCOUNTS_BY_ADDRESS_FETCHED, data)