fix skipping hidden chats

This commit is contained in:
Jonathan Rainville 2024-10-30 11:30:46 -04:00 committed by Lukáš Tinkl
parent 3dd94f4b72
commit d6d546739d
1 changed files with 7 additions and 16 deletions

View File

@ -991,24 +991,15 @@ method rebuildChatSearchModel*[T](self: Module[T]) =
for chat in self.controller.getAllChats(): for chat in self.controller.getAllChats():
let communityId = chat.communityId let communityId = chat.communityId
# try to skip hidden chats # skip hidden chats
if chat.chatType == ChatType.CommunityChat and communityId != "": if chat.chatType == ChatType.CommunityChat and communityId != "":
let communityDto = self.controller.getCommunityById(communityId) let communityDto = self.controller.getCommunityById(communityId)
var chatId = chat.id if communityDto.hasCommunityChat(chat.id):
if not communityDto.hasCommunityChat(chatId): let communityChat = communityDto.getCommunityChat(chat.id)
# try with shortened chatId
warn "!!! main-module, unexisting communityId for chatId", communityId, chatId
chatId.removePrefix(communityId)
if not chatId.startsWith("0x"):
chatId = "0x" % chatId
if not communityDto.hasCommunityChat(chatId):
warn "!!! main-module, unexisting communityId for shortened chatId", communityId, chatId
#continue
else:
let communityChat = communityDto.getCommunityChat(chatId)
if communityChat.isHiddenChat: if communityChat.isHiddenChat:
continue continue
else:
continue
var chatName = chat.name var chatName = chat.name
var chatImage = chat.icon var chatImage = chat.icon