fix(@desktop/communities): reaction are being displayed on pinned message

fixes #2838

This also fix the ability to add/remove a reaction to a pinned message
This commit is contained in:
Anthony Laibe 2021-07-19 09:11:28 +02:00 committed by Iuri Matias
parent 68c9b533d4
commit 8a4eeb14c0
2 changed files with 11 additions and 2 deletions

View File

@ -113,7 +113,12 @@ QtObject:
result.connected = false result.connected = false
result.currentSuggestions = newSuggestionsList() result.currentSuggestions = newSuggestionsList()
result.activityNotificationList = newActivityNotificationList(status) result.activityNotificationList = newActivityNotificationList(status)
result.reactions = newReactionView(status, result.messageView.messageList.addr, result.channelView.activeChannel) result.reactions = newReactionView(
status,
result.messageView.messageList.addr,
result.messageView.pinnedMessagesList.addr,
result.channelView.activeChannel
)
result.stickers = newStickersView(status, result.channelView.activeChannel) result.stickers = newStickersView(status, result.channelView.activeChannel)
result.groups = newGroupsView(status,result.channelView.activeChannel) result.groups = newGroupsView(status,result.channelView.activeChannel)
result.transactions = newTransactionsView(status) result.transactions = newTransactionsView(status)

View File

@ -10,6 +10,7 @@ logScope:
QtObject: QtObject:
type ReactionView* = ref object of QObject type ReactionView* = ref object of QObject
messageList: ptr OrderedTable[string, ChatMessageList] messageList: ptr OrderedTable[string, ChatMessageList]
pinnedMessageList: ptr OrderedTable[string, ChatMessageList]
activeChannel: ChatItemView activeChannel: ChatItemView
status: Status status: Status
pubKey*: string pubKey*: string
@ -20,10 +21,11 @@ QtObject:
proc delete*(self: ReactionView) = proc delete*(self: ReactionView) =
self.QObject.delete self.QObject.delete
proc newReactionView*(status: Status, messageList: ptr OrderedTable[string, ChatMessageList], activeChannel: ChatItemView): ReactionView = proc newReactionView*(status: Status, messageList: ptr OrderedTable[string, ChatMessageList], pinnedMessageList: ptr OrderedTable[string, ChatMessageList], activeChannel: ChatItemView): ReactionView =
new(result, delete) new(result, delete)
result = ReactionView() result = ReactionView()
result.messageList = messageList result.messageList = messageList
result.pinnedMessageList = pinnedMessageList
result.status = status result.status = status
result.activeChannel = activeChannel result.activeChannel = activeChannel
result.setup result.setup
@ -82,6 +84,7 @@ QtObject:
# Remove the reaction # Remove the reaction
oldReactions.delete(reaction.id) oldReactions.delete(reaction.id)
messageList.setMessageReactions(reaction.messageId, $oldReactions) messageList.setMessageReactions(reaction.messageId, $oldReactions)
self.pinnedMessageList[][chatId].setMessageReactions(reaction.messageId, $oldReactions)
continue continue
oldReactions[reaction.id] = %* { oldReactions[reaction.id] = %* {
@ -89,3 +92,4 @@ QtObject:
"emojiId": reaction.emojiId "emojiId": reaction.emojiId
} }
messageList.setMessageReactions(reaction.messageId, $oldReactions) messageList.setMessageReactions(reaction.messageId, $oldReactions)
self.pinnedMessageList[][chatId].setMessageReactions(reaction.messageId, $oldReactions)