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:
parent
e9051e27ad
commit
9ef807277e
|
@ -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)
|
||||
|
||||
|
|
|
@ -399,17 +399,19 @@ QtObject:
|
|||
error "an error occurred while accepting contact request", msg=e.msg
|
||||
|
||||
proc dismissContactRequest*(self: Service, publicKey: string) =
|
||||
# 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))
|
||||
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)
|
||||
|
|
|
@ -176,7 +176,7 @@ SettingsContentBase {
|
|||
}
|
||||
|
||||
onContactRequestRejected: {
|
||||
root.contactsStore.rejectContactRequest(publicKey)
|
||||
root.contactsStore.dismissContactRequest(publicKey)
|
||||
}
|
||||
|
||||
onShowVerificationRequest: {
|
||||
|
|
Loading…
Reference in New Issue