fix(Chat): ensure new active channel messages are marked as seen
Also, selecting a channel with unread messages marks them as seen as well Closes #738
This commit is contained in:
parent
22a86b939f
commit
f47fda6d68
|
@ -177,6 +177,7 @@ QtObject:
|
|||
|
||||
self.activeChannel.setChatItem(selectedChannel)
|
||||
self.status.chat.setActiveChannel(selectedChannel.id)
|
||||
discard self.status.chat.markAllChannelMessagesRead(selectedChannel.id)
|
||||
self.currentSuggestions.setNewData(self.status.contacts.getContacts())
|
||||
self.activeChannelChanged()
|
||||
|
||||
|
@ -207,6 +208,7 @@ QtObject:
|
|||
proc setActiveChannel*(self: ChatsView, channel: string) {.slot.} =
|
||||
if(channel == ""): return
|
||||
self.activeChannel.setChatItem(self.chats.getChannel(self.chats.chats.findIndexById(channel)))
|
||||
discard self.status.chat.markAllChannelMessagesRead(self.activeChannel.id)
|
||||
self.currentSuggestions.setNewData(self.status.contacts.getContacts())
|
||||
self.activeChannelChanged()
|
||||
|
||||
|
@ -253,6 +255,7 @@ QtObject:
|
|||
if not channel.muted:
|
||||
self.messageNotificationPushed(msg.chatId, msg.text, msg.messageType, channel.chatType.int, msg.timestamp, msg.identicon, msg.alias)
|
||||
else:
|
||||
discard self.status.chat.markMessagesSeen(msg.chatId, @[msg.id])
|
||||
self.newMessagePushed()
|
||||
|
||||
proc messageEmojiReactionId(self: ChatsView, chatId: string, messageId: string, emojiId: int): string =
|
||||
|
|
|
@ -292,6 +292,12 @@ proc markAllChannelMessagesRead*(self: ChatModel, chatId: string): JsonNode =
|
|||
self.channels[chatId].unviewedMessagesCount = 0
|
||||
self.events.emit("channelUpdate", ChatUpdateArgs(messages: @[], chats: @[self.channels[chatId]], contacts: @[]))
|
||||
|
||||
proc markMessagesSeen*(self: ChatModel, chatId: string, messageIds: seq[string]): JsonNode =
|
||||
var response = status_chat.markMessagesSeen(chatId, messageIds)
|
||||
result = parseJson(response)
|
||||
if self.channels.hasKey(chatId):
|
||||
self.channels[chatId].unviewedMessagesCount = 0
|
||||
self.events.emit("channelUpdate", ChatUpdateArgs(messages: @[], chats: @[self.channels[chatId]], contacts: @[]))
|
||||
|
||||
proc confirmJoiningGroup*(self: ChatModel, chatId: string) =
|
||||
var response = status_chat.confirmJoiningGroup(chatId)
|
||||
|
|
|
@ -154,6 +154,9 @@ proc sendStickerMessage*(chatId: string, sticker: Sticker): string =
|
|||
proc markAllRead*(chatId: string): string =
|
||||
callPrivateRPC("markAllRead".prefix, %* [chatId])
|
||||
|
||||
proc markMessagesSeen*(chatId: string, messageIds: seq[string]): string =
|
||||
callPrivateRPC("markMessagesSeen".prefix, %* [chatId, messageIds])
|
||||
|
||||
proc confirmJoiningGroup*(chatId: string): string =
|
||||
callPrivateRPC("confirmJoiningGroup".prefix, %* [chatId])
|
||||
|
||||
|
|
Loading…
Reference in New Issue