feat: support seeing who liked a message

This commit is contained in:
hydrogen 2020-11-23 11:50:00 +02:00 committed by Iuri Matias
parent 2baa55b5c4
commit 9f6e582111

View File

@ -1,4 +1,5 @@
import QtQuick 2.3
import QtQuick.Controls 2.13
import "../../../../../shared"
import "../../../../../imports"
@ -23,11 +24,13 @@ Item {
if (!byEmoji[reaction.emojiId]) {
byEmoji[reaction.emojiId] = {
emojiId: reaction.emojiId,
fromAccounts: [],
count: 0,
currentUserReacted: false
}
}
byEmoji[reaction.emojiId].count++;
byEmoji[reaction.emojiId].fromAccounts.push(chatsModel.userNameOrAlias(reaction.from));
if (!byEmoji[reaction.emojiId].currentUserReacted && reaction.from === profileModel.profile.pubKey) {
byEmoji[reaction.emojiId].currentUserReacted = true
}
@ -49,6 +52,11 @@ Item {
anchors.leftMargin: (index === 0) ? 0 : root.imageMargin
color: modelData.currentUserReacted ? Style.current.primary : Style.current.inputBackground
ToolTip {
visible: mouseArea.containsMouse
text: modelData.fromAccounts.join(", ")
}
// Rounded corner to cover one corner
Rectangle {
color: parent.color
@ -95,7 +103,9 @@ Item {
}
MouseArea {
id: mouseArea
anchors.fill: parent
hoverEnabled: true
cursorShape: Qt.PointingHandCursor
onClicked: {
chatsModel.toggleEmojiReaction(messageId, modelData.emojiId)