diff --git a/src/app/modules/main/chat_section/controller.nim b/src/app/modules/main/chat_section/controller.nim index 8b330bafed..dec16c3e8a 100644 --- a/src/app/modules/main/chat_section/controller.nim +++ b/src/app/modules/main/chat_section/controller.nim @@ -333,12 +333,11 @@ proc init*(self: Controller) = if (self.sectionId != args.sectionId): return self.delegate.makeChatWithIdActive(args.chatId) - - 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) + + if (not self.isCommunitySection): + self.events.on(SIGNAL_CHAT_SWITCH_TO_OR_CREATE_1_1_CHAT) do(e:Args): + let args = ChatExtArgs(e) + self.delegate.createOneToOneChat(args.communityId, args.chatId, args.ensName) self.events.on(SIGNAL_CONTACTS_STATUS_UPDATED) do(e: Args): let args = ContactsStatusUpdatedArgs(e) diff --git a/src/app/modules/main/chat_section/module.nim b/src/app/modules/main/chat_section/module.nim index c21415f0c0..da96c41a86 100644 --- a/src/app/modules/main/chat_section/module.nim +++ b/src/app/modules/main/chat_section/module.nim @@ -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)): @@ -719,9 +722,9 @@ method switchToOrCreateOneToOneChat*(self: Module, chatId: string) = method createOneToOneChat*(self: Module, communityID: string, chatId: string, ensName: string) = if(self.controller.isCommunity()): - # initiate chat creation in the `Chat` seciton module. - self.controller.switchToOrCreateOneToOneChat(chatId, ensName) - return + # initiate chat creation in the `Chat` seciton module. + self.controller.switchToOrCreateOneToOneChat(chatId, ensName) + return # Adding this call here we have the same as we had before (didn't inspect what are all cases when this # `createOneToOneChat` is called), but I am sure that after checking all cases and inspecting them, this can be improved.