fix(community-chats): fix community chats getting duplicated

Fixes #4859 and #4858
This commit is contained in:
Jonathan Rainville 2022-02-22 11:50:48 -05:00 committed by Iuri Matias
parent 26477afb3b
commit f7860310db
1 changed files with 9 additions and 8 deletions

View File

@ -745,13 +745,14 @@ method addChatIfDontExist*(self: Module,
gifService: gif_service.Service,
mailserversService: mailservers_service.Service,
setChatAsActive: bool = true) =
if(belongsToCommunity and self.controller.getMySectionId() != chat.communityId or
not belongsToCommunity and self.controller.getMySectionId() != conf.CHAT_SECTION_ID):
return
if self.doesChatExist(chat.id):
return
let sectionId = self.controller.getMySectionId()
if(belongsToCommunity and sectionId != chat.communityId or
not belongsToCommunity and sectionId != conf.CHAT_SECTION_ID):
return
if self.doesChatExist(chat.id):
return
self.addNewChat(chat, belongsToCommunity, events, settingsService, contactService, chatService,
communityService, messageService, gifService, mailserversService, setChatAsActive)
self.addNewChat(chat, belongsToCommunity, events, settingsService, contactService, chatService,
communityService, messageService, gifService, mailserversService, setChatAsActive)