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) =
|
||||||
|
try:
|
||||||
# NOTE: publicKey used for dismissing last request
|
# NOTE: publicKey used for dismissing last request
|
||||||
let response = status_contacts.dismissLatestContactRequestForContact(publicKey)
|
let response = status_contacts.dismissLatestContactRequestForContact(publicKey)
|
||||||
if(not response.error.isNil):
|
if(not response.error.isNil):
|
||||||
let msg = response.error.message
|
let msg = response.error.message
|
||||||
error "error dismissing contact ", msg
|
error "error dismissing contact ", msg
|
||||||
return
|
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