From ba500e5f739d2fee7c166e6d8c24f82bf08031c9 Mon Sep 17 00:00:00 2001 From: Jonathan Rainville Date: Fri, 9 Apr 2021 13:21:39 -0400 Subject: [PATCH] fix: fix notifications not working for community chats Fixes #2210 --- src/app/chat/view.nim | 6 ++++-- src/app/chat/views/communities.nim | 10 +++++++++- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/src/app/chat/view.nim b/src/app/chat/view.nim index e71d74050d..dbadbdf7fc 100644 --- a/src/app/chat/view.nim +++ b/src/app/chat/view.nim @@ -482,9 +482,11 @@ 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): - continue + channel = self.communities.getChannel(msg.chatId) + if (channel == nil): + continue if msg.chatId == self.activeChannel.id: discard self.status.chat.markMessagesSeen(msg.chatId, @[msg.id]) diff --git a/src/app/chat/views/communities.nim b/src/app/chat/views/communities.nim index 29bb63cf47..e8910298a8 100644 --- a/src/app/chat/views/communities.nim +++ b/src/app/chat/views/communities.nim @@ -340,4 +340,12 @@ QtObject: except Exception as e: error "Error declining request to join the community", msg = e.msg return "Error declining request to join the community" - return "" \ No newline at end of file + 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 + + \ No newline at end of file