fix: fix notifications not working for community chats

Fixes #2210
This commit is contained in:
Jonathan Rainville 2021-04-09 13:21:39 -04:00 committed by Iuri Matias
parent 5ae5cd7efa
commit ba500e5f73
2 changed files with 13 additions and 3 deletions

View File

@ -482,7 +482,9 @@ QtObject:
msgIndex = self.messageList[msg.chatId].messages.len - 1
self.messagePushed(msgIndex)
if self.channelOpenTime.getOrDefault(msg.chatId, high(int64)) < msg.timestamp.parseFloat.fromUnixFloat.toUnix:
let channel = self.chats.getChannelById(msg.chatId)
var channel = self.chats.getChannelById(msg.chatId)
if (channel == nil):
channel = self.communities.getChannel(msg.chatId)
if (channel == nil):
continue

View File

@ -341,3 +341,11 @@ QtObject:
error "Error declining request to join the community", msg = e.msg
return "Error declining request to join the community"
return ""
proc getChannel*(self: CommunitiesView, channelId: string): Chat =
for community in self.joinedCommunityList.communities:
for chat in community.chats:
if (chat.id == channelId):
return chat