fix(contacts): retract the contact request when removing a contact

Fixes #7791

Adds the retractContactRequest status-go api call. Calling it when removing a contact makes sure to send a signal to that other user so they can understand that we are no longer mutual contacts or don't have a request anymore
This commit is contained in:
Jonathan Rainville 2022-10-25 14:29:49 -04:00 committed by r4bbit.eth
parent a69b3b5928
commit ed4ecb17bb
2 changed files with 10 additions and 0 deletions

View File

@ -490,6 +490,10 @@ QtObject:
proc removeContact*(self: Service, publicKey: string) =
var contact = self.getContactById(publicKey)
if contact.added:
discard status_contacts.retractContactRequest(publicKey)
contact.removed = true
contact.added = false

View File

@ -102,3 +102,9 @@ proc getReceivedVerificationRequests*(): RpcResponse[JsonNode] {.raises: [Except
proc cancelVerificationRequest*(pubkey: string): RpcResponse[JsonNode] {.raises: [Exception].} =
let payload = %* [pubkey]
result = callPrivateRPC("cancelVerificationRequest".prefix, payload)
proc retractContactRequest*(pubkey: string): RpcResponse[JsonNode] {.raises: [Exception].} =
let payload = %*[{
"contactId": pubkey
}]
result = callPrivateRPC("retractContactRequest".prefix, payload)