fix: fix channel not updating on new messages

This commit is contained in:
Jonathan Rainville 2021-01-20 16:06:15 -05:00 committed by Iuri Matias
parent ea89ebd960
commit 64a0710897
2 changed files with 5 additions and 3 deletions

View File

@ -322,13 +322,13 @@ QtObject:
let channel = self.chats.getChannelById(msg.chatId)
if (channel == nil):
continue
let isAddedContact = channel.chatType.isOneToOne and self.status.contacts.isAdded(channel.id)
if msg.chatId == self.activeChannel.id:
discard self.status.chat.markMessagesSeen(msg.chatId, @[msg.id])
self.newMessagePushed()
if not channel.muted:
let isAddedContact = channel.chatType.isOneToOne and self.status.contacts.isAdded(channel.id)
self.messageNotificationPushed(
msg.chatId,
escape_html(msg.text),

View File

@ -147,8 +147,10 @@ QtObject:
let idx = self.upsertChannel(channel)
if idx == -1: return
let topLeft = self.createIndex(0, 0, nil)
let bottomRight = self.createIndex(self.chats.len, 0, nil)
let topLeft = self.createIndex(idx, 0, nil)
let bottomRight = self.createIndex(idx, 0, nil)
self.chats[idx] = channel
self.dataChanged(topLeft, bottomRight, @[ChannelsRoles.Name.int, ChannelsRoles.Description.int, ChannelsRoles.ContentType.int, ChannelsRoles.LastMessage.int, ChannelsRoles.Timestamp.int, ChannelsRoles.UnreadMessages.int, ChannelsRoles.Identicon.int, ChannelsRoles.ChatType.int, ChannelsRoles.Color.int, ChannelsRoles.HasMentions.int, ChannelsRoles.Muted.int])