fix(@desktop/chat): adding a contact with chat key should not immediately open a 1 on 1 chat or should block input
Fixes #5767
This commit is contained in:
parent
88bbfef179
commit
e2cdff1a98
|
@ -591,7 +591,6 @@ method acceptContactRequest*(self: Module, publicKey: string) =
|
||||||
method onContactAccepted*(self: Module, publicKey: string) =
|
method onContactAccepted*(self: Module, publicKey: string) =
|
||||||
self.view.contactRequestsModel().removeItemWithPubKey(publicKey)
|
self.view.contactRequestsModel().removeItemWithPubKey(publicKey)
|
||||||
self.updateParentBadgeNotifications()
|
self.updateParentBadgeNotifications()
|
||||||
self.createOneToOneChat(communityID = "" , publicKey, ensName = "")
|
|
||||||
|
|
||||||
method acceptAllContactRequests*(self: Module) =
|
method acceptAllContactRequests*(self: Module) =
|
||||||
let pubKeys = self.view.contactRequestsModel().getPublicKeys()
|
let pubKeys = self.view.contactRequestsModel().getPublicKeys()
|
||||||
|
|
|
@ -2,20 +2,24 @@ import io_interface
|
||||||
|
|
||||||
import ../../../../core/eventemitter
|
import ../../../../core/eventemitter
|
||||||
import ../../../../../app_service/service/contacts/service as contacts_service
|
import ../../../../../app_service/service/contacts/service as contacts_service
|
||||||
|
import ../../../../../app_service/service/chat/service as chat_service
|
||||||
|
|
||||||
type
|
type
|
||||||
Controller* = ref object of RootObj
|
Controller* = ref object of RootObj
|
||||||
delegate: io_interface.AccessInterface
|
delegate: io_interface.AccessInterface
|
||||||
events: EventEmitter
|
events: EventEmitter
|
||||||
contactsService: contacts_service.Service
|
contactsService: contacts_service.Service
|
||||||
|
chatService: chat_service.Service
|
||||||
|
|
||||||
proc newController*(delegate: io_interface.AccessInterface,
|
proc newController*(delegate: io_interface.AccessInterface,
|
||||||
events: EventEmitter,
|
events: EventEmitter,
|
||||||
contactsService: contacts_service.Service): Controller =
|
contactsService: contacts_service.Service,
|
||||||
|
chatService: chat_service.Service): Controller =
|
||||||
result = Controller()
|
result = Controller()
|
||||||
result.delegate = delegate
|
result.delegate = delegate
|
||||||
result.events = events
|
result.events = events
|
||||||
result.contactsService = contactsService
|
result.contactsService = contactsService
|
||||||
|
result.chatService = chatService
|
||||||
|
|
||||||
proc delete*(self: Controller) =
|
proc delete*(self: Controller) =
|
||||||
discard
|
discard
|
||||||
|
@ -78,4 +82,7 @@ proc rejectContactRequest*(self: Controller, publicKey: string) =
|
||||||
self.contactsService.rejectContactRequest(publicKey)
|
self.contactsService.rejectContactRequest(publicKey)
|
||||||
|
|
||||||
proc removeContactRequestRejection*(self: Controller, publicKey: string) =
|
proc removeContactRequestRejection*(self: Controller, publicKey: string) =
|
||||||
self.contactsService.removeContactRequestRejection(publicKey)
|
self.contactsService.removeContactRequestRejection(publicKey)
|
||||||
|
|
||||||
|
proc switchToOrCreateOneToOneChat*(self: Controller, chatId: string) =
|
||||||
|
self.chatService.switchToOrCreateOneToOneChat(chatId, "")
|
|
@ -25,6 +25,9 @@ method viewDidLoad*(self: AccessInterface) {.base.} =
|
||||||
method addContact*(self: AccessInterface, publicKey: string) {.base.} =
|
method addContact*(self: AccessInterface, publicKey: string) {.base.} =
|
||||||
raise newException(ValueError, "No implementation available")
|
raise newException(ValueError, "No implementation available")
|
||||||
|
|
||||||
|
method switchToOrCreateOneToOneChat*(self: AccessInterface, publicKey: string) {.base.} =
|
||||||
|
raise newException(ValueError, "No implementation available")
|
||||||
|
|
||||||
method acceptContactRequests*(self: AccessInterface, publicKeysJSON: string) {.base.} =
|
method acceptContactRequests*(self: AccessInterface, publicKeysJSON: string) {.base.} =
|
||||||
raise newException(ValueError, "No implementation available")
|
raise newException(ValueError, "No implementation available")
|
||||||
|
|
||||||
|
|
|
@ -8,6 +8,7 @@ import ../../../../global/global_singleton
|
||||||
|
|
||||||
import ../../../../core/eventemitter
|
import ../../../../core/eventemitter
|
||||||
import ../../../../../app_service/service/contacts/service as contacts_service
|
import ../../../../../app_service/service/contacts/service as contacts_service
|
||||||
|
import ../../../../../app_service/service/chat/service as chat_service
|
||||||
|
|
||||||
export io_interface
|
export io_interface
|
||||||
|
|
||||||
|
@ -24,13 +25,14 @@ type
|
||||||
|
|
||||||
proc newModule*(delegate: delegate_interface.AccessInterface,
|
proc newModule*(delegate: delegate_interface.AccessInterface,
|
||||||
events: EventEmitter,
|
events: EventEmitter,
|
||||||
contactsService: contacts_service.Service):
|
contactsService: contacts_service.Service,
|
||||||
|
chatService: chat_service.Service):
|
||||||
Module =
|
Module =
|
||||||
result = Module()
|
result = Module()
|
||||||
result.delegate = delegate
|
result.delegate = delegate
|
||||||
result.view = newView(result)
|
result.view = newView(result)
|
||||||
result.viewVariant = newQVariant(result.view)
|
result.viewVariant = newQVariant(result.view)
|
||||||
result.controller = controller.newController(result, events, contactsService)
|
result.controller = controller.newController(result, events, contactsService, chatService)
|
||||||
result.moduleLoaded = false
|
result.moduleLoaded = false
|
||||||
|
|
||||||
method delete*(self: Module) =
|
method delete*(self: Module) =
|
||||||
|
@ -77,6 +79,9 @@ method getModuleAsVariant*(self: Module): QVariant =
|
||||||
method addContact*(self: Module, publicKey: string) =
|
method addContact*(self: Module, publicKey: string) =
|
||||||
self.controller.addContact(publicKey)
|
self.controller.addContact(publicKey)
|
||||||
|
|
||||||
|
method switchToOrCreateOneToOneChat*(self: Module, publicKey: string) =
|
||||||
|
self.controller.switchToOrCreateOneToOneChat(publicKey)
|
||||||
|
|
||||||
method rejectContactRequest*(self: Module, publicKey: string) =
|
method rejectContactRequest*(self: Module, publicKey: string) =
|
||||||
self.controller.rejectContactRequest(publicKey)
|
self.controller.rejectContactRequest(publicKey)
|
||||||
|
|
||||||
|
|
|
@ -126,6 +126,9 @@ QtObject:
|
||||||
proc addContact*(self: View, publicKey: string) {.slot.} =
|
proc addContact*(self: View, publicKey: string) {.slot.} =
|
||||||
self.delegate.addContact(publicKey)
|
self.delegate.addContact(publicKey)
|
||||||
|
|
||||||
|
proc switchToOrCreateOneToOneChat*(self: View, publicKey: string) {.slot.} =
|
||||||
|
self.delegate.switchToOrCreateOneToOneChat(publicKey)
|
||||||
|
|
||||||
proc rejectContactRequest*(self: View, publicKey: string) {.slot.} =
|
proc rejectContactRequest*(self: View, publicKey: string) {.slot.} =
|
||||||
self.delegate.rejectContactRequest(publicKey)
|
self.delegate.rejectContactRequest(publicKey)
|
||||||
|
|
||||||
|
|
|
@ -77,7 +77,7 @@ proc newModule*(delegate: delegate_interface.AccessInterface,
|
||||||
result.moduleLoaded = false
|
result.moduleLoaded = false
|
||||||
|
|
||||||
result.profileModule = profile_module.newModule(result, profileService)
|
result.profileModule = profile_module.newModule(result, profileService)
|
||||||
result.contactsModule = contacts_module.newModule(result, events, contactsService)
|
result.contactsModule = contacts_module.newModule(result, events, contactsService, chatService)
|
||||||
result.languageModule = language_module.newModule(result, languageService)
|
result.languageModule = language_module.newModule(result, languageService)
|
||||||
result.privacyModule = privacy_module.newModule(result, events, settingsService, privacyService, generalService)
|
result.privacyModule = privacy_module.newModule(result, events, settingsService, privacyService, generalService)
|
||||||
result.aboutModule = about_module.newModule(result, events, aboutService)
|
result.aboutModule = about_module.newModule(result, events, aboutService)
|
||||||
|
|
|
@ -38,7 +38,7 @@ QtObject {
|
||||||
|
|
||||||
function joinPrivateChat(pubKey) {
|
function joinPrivateChat(pubKey) {
|
||||||
Global.changeAppSectionBySectionType(Constants.appSection.chat)
|
Global.changeAppSectionBySectionType(Constants.appSection.chat)
|
||||||
root.contactsModule.addContact(pubKey)
|
root.contactsModule.switchToOrCreateOneToOneChat(pubKey)
|
||||||
}
|
}
|
||||||
|
|
||||||
function addContact(pubKey) {
|
function addContact(pubKey) {
|
||||||
|
|
Loading…
Reference in New Issue