diff --git a/src/app_service/service/contacts/service.nim b/src/app_service/service/contacts/service.nim index 65d4494bd8..f57e55b07a 100644 --- a/src/app_service/service/contacts/service.nim +++ b/src/app_service/service/contacts/service.nim @@ -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 diff --git a/src/backend/contacts.nim b/src/backend/contacts.nim index 418d6f60cf..6e04175fc0 100644 --- a/src/backend/contacts.nim +++ b/src/backend/contacts.nim @@ -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)