fix(contacts): only open 1x1 chat when mutual contact when sending req

Fixes #6291
This commit is contained in:
Jonathan Rainville 2022-06-30 09:37:25 -04:00 committed by Iuri Matias
parent 5a1f0a3d3a
commit deca07c0c6
3 changed files with 11 additions and 4 deletions

View File

@ -90,7 +90,7 @@ proc init*(self: Controller) =
self.events.on(SIGNAL_CONTACT_ADDED) do(e: Args):
var args = ContactArgs(e)
self.delegate.onContactAccepted(args.contactId)
self.delegate.onContactAdded(args.contactId)
self.events.on(SIGNAL_CONTACT_REMOVED) do(e: Args):
var args = ContactArgs(e)
@ -281,6 +281,9 @@ proc getCurrentFleet*(self: Controller): string =
proc getContacts*(self: Controller, group: ContactsGroup): seq[ContactsDto] =
return self.contactService.getContactsByGroup(group)
proc getContactById*(self: Controller, id: string): ContactsDto =
return self.contactService.getContactById(id)
proc getContactDetails*(self: Controller, id: string): ContactDetails =
return self.contactService.getContactDetails(id)

View File

@ -94,7 +94,7 @@ method onChatUnmuted*(self: AccessInterface, chatId: string) {.base.} =
method onMarkAllMessagesRead*(self: AccessInterface, chatId: string) {.base.} =
raise newException(ValueError, "No implementation available")
method onContactAccepted*(self: AccessInterface, publicKey: string) {.base.} =
method onContactAdded*(self: AccessInterface, publicKey: string) {.base.} =
raise newException(ValueError, "No implementation available")
method onContactRejected*(self: AccessInterface, publicKey: string) {.base.} =

View File

@ -597,9 +597,13 @@ method getCurrentFleet*(self: Module): string =
method acceptContactRequest*(self: Module, publicKey: string) =
self.controller.acceptContactRequest(publicKey)
method onContactAccepted*(self: Module, publicKey: string) =
method onContactAdded*(self: Module, publicKey: string) =
self.view.contactRequestsModel().removeItemById(publicKey)
self.switchToOrCreateOneToOneChat(publicKey)
let contact = self.controller.getContactById(publicKey)
if (contact.isMutualContact):
self.switchToOrCreateOneToOneChat(publicKey)
self.updateParentBadgeNotifications()
method acceptAllContactRequests*(self: Module) =