fix(@desktop/chat): Fix accepting and rejecting requests

Adding try/catch in a service
Fix naming in QML

Fix #6395
This commit is contained in:
Michal Iskierko 2022-07-13 11:41:09 +02:00 committed by Michał Iskierko
parent e9051e27ad
commit 9ef807277e
3 changed files with 17 additions and 12 deletions

View File

@ -135,6 +135,9 @@ QtObject:
proc switchToOrCreateOneToOneChat*(self: View, publicKey: string) {.slot.} =
self.delegate.switchToOrCreateOneToOneChat(publicKey)
proc acceptContactRequest*(self: View, publicKey: string) {.slot.} =
self.delegate.acceptContactRequest(publicKey)
proc dismissContactRequest*(self: View, publicKey: string) {.slot.} =
self.delegate.dismissContactRequest(publicKey)

View File

@ -399,17 +399,19 @@ QtObject:
error "an error occurred while accepting contact request", msg=e.msg
proc dismissContactRequest*(self: Service, publicKey: string) =
try:
# NOTE: publicKey used for dismissing last request
let response = status_contacts.dismissLatestContactRequestForContact(publicKey)
if(not response.error.isNil):
let msg = response.error.message
error "error dismissing contact ", msg
return
var contact = self.getContactById(publicKey)
contact.removed = true
self.saveContact(contact)
self.events.emit(SIGNAL_CONTACT_REMOVED, ContactArgs(contactId: contact.id))
except Exception as e:
error "an error occurred while dismissing contact request", msg=e.msg
proc removeContactRequestRejection*(self: Service, publicKey: string) =
var contact = self.getContactById(publicKey)

View File

@ -176,7 +176,7 @@ SettingsContentBase {
}
onContactRequestRejected: {
root.contactsStore.rejectContactRequest(publicKey)
root.contactsStore.dismissContactRequest(publicKey)
}
onShowVerificationRequest: {