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.} =
|
proc switchToOrCreateOneToOneChat*(self: View, publicKey: string) {.slot.} =
|
||||||
self.delegate.switchToOrCreateOneToOneChat(publicKey)
|
self.delegate.switchToOrCreateOneToOneChat(publicKey)
|
||||||
|
|
||||||
|
proc acceptContactRequest*(self: View, publicKey: string) {.slot.} =
|
||||||
|
self.delegate.acceptContactRequest(publicKey)
|
||||||
|
|
||||||
proc dismissContactRequest*(self: View, publicKey: string) {.slot.} =
|
proc dismissContactRequest*(self: View, publicKey: string) {.slot.} =
|
||||||
self.delegate.dismissContactRequest(publicKey)
|
self.delegate.dismissContactRequest(publicKey)
|
||||||
|
|
||||||
|
|
|
@ -399,17 +399,19 @@ QtObject:
|
||||||
error "an error occurred while accepting contact request", msg=e.msg
|
error "an error occurred while accepting contact request", msg=e.msg
|
||||||
|
|
||||||
proc dismissContactRequest*(self: Service, publicKey: string) =
|
proc dismissContactRequest*(self: Service, publicKey: string) =
|
||||||
# NOTE: publicKey used for dismissing last request
|
try:
|
||||||
let response = status_contacts.dismissLatestContactRequestForContact(publicKey)
|
# NOTE: publicKey used for dismissing last request
|
||||||
if(not response.error.isNil):
|
let response = status_contacts.dismissLatestContactRequestForContact(publicKey)
|
||||||
let msg = response.error.message
|
if(not response.error.isNil):
|
||||||
error "error dismissing contact ", msg
|
let msg = response.error.message
|
||||||
return
|
error "error dismissing contact ", msg
|
||||||
|
return
|
||||||
var contact = self.getContactById(publicKey)
|
var contact = self.getContactById(publicKey)
|
||||||
contact.removed = true
|
contact.removed = true
|
||||||
self.saveContact(contact)
|
self.saveContact(contact)
|
||||||
self.events.emit(SIGNAL_CONTACT_REMOVED, ContactArgs(contactId: contact.id))
|
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) =
|
proc removeContactRequestRejection*(self: Service, publicKey: string) =
|
||||||
var contact = self.getContactById(publicKey)
|
var contact = self.getContactById(publicKey)
|
||||||
|
|
|
@ -176,7 +176,7 @@ SettingsContentBase {
|
||||||
}
|
}
|
||||||
|
|
||||||
onContactRequestRejected: {
|
onContactRequestRejected: {
|
||||||
root.contactsStore.rejectContactRequest(publicKey)
|
root.contactsStore.dismissContactRequest(publicKey)
|
||||||
}
|
}
|
||||||
|
|
||||||
onShowVerificationRequest: {
|
onShowVerificationRequest: {
|
||||||
|
|
Loading…
Reference in New Issue