fix(chat_section): Open Chat section before creating or switching to one-to-one chat

Fixes: #9880
This commit is contained in:
Boris Melnik 2023-03-21 19:27:40 +03:00
parent ec6d35a6bd
commit 5592335b2f
2 changed files with 12 additions and 10 deletions

View File

@ -334,10 +334,9 @@ proc init*(self: Controller) =
return
self.delegate.makeChatWithIdActive(args.chatId)
if (not self.isCommunitySection):
self.events.on(SIGNAL_CHAT_SWITCH_TO_OR_CREATE_1_1_CHAT) do(e:Args):
let args = ChatExtArgs(e)
if (self.isCommunitySection):
return
self.delegate.createOneToOneChat(args.communityId, args.chatId, args.ensName)
self.events.on(SIGNAL_CONTACTS_STATUS_UPDATED) do(e: Args):

View File

@ -708,7 +708,10 @@ method onCommunityChannelEdited*(self: Module, chat: ChatDto) =
method switchToOrCreateOneToOneChat*(self: Module, chatId: string) =
# One To One chat is available only in the `Chat` section
if(self.controller.getMySectionId() != singletonInstance.userProfile.getPubKey()):
if (self.controller.getMySectionId() == singletonInstance.userProfile.getPubKey()) and (self.delegate.getActiveSectionId() != self.controller.getMySectionId()):
self.delegate.setActiveSectionById(self.controller.getMySectionId())
# if its not `Chat` section - skip
else:
return
if(self.chatContentModules.hasKey(chatId)):