fix(chat): correct logic in switchToOrCreateOneToOneChat

fixes: #10129
This commit is contained in:
Patryk Osmaczko 2023-04-03 14:05:09 +02:00 committed by osmaczko
parent e86a625b92
commit 847ad5e7de

View File

@ -705,12 +705,12 @@ 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()) and (self.delegate.getActiveSectionId() != self.controller.getMySectionId()):
self.delegate.setActiveSectionById(self.controller.getMySectionId())
# if its not `Chat` section - skip
else:
if (self.controller.getMySectionId() != singletonInstance.userProfile.getPubKey()):
return
if (self.delegate.getActiveSectionId() != self.controller.getMySectionId()):
self.delegate.setActiveSectionById(self.controller.getMySectionId())
if(self.chatContentModules.hasKey(chatId)):
self.setActiveItem(chatId)
return