fix: show emoji in reaction tooltip
Fixes: #2387. Shows the emoji in the emoji reaction tooltip instead of the shorthand (ie 👎 instead of `👎`).
This commit is contained in:
parent
9493839b65
commit
65a0cfbcd3
|
@ -46,16 +46,11 @@ Item {
|
|||
|
||||
//% " reacted with "
|
||||
tooltip += qsTrId("-reacted-with-");
|
||||
|
||||
switch (emojiId) {
|
||||
case 1: return tooltip + ":heart:"
|
||||
case 2: return tooltip + ":thumbsup:"
|
||||
case 3: return tooltip + ":thumbsdown:"
|
||||
case 4: return tooltip + ":laughing:"
|
||||
case 5: return tooltip + ":cry:"
|
||||
case 6: return tooltip + ":angry:"
|
||||
default: return tooltip
|
||||
let emojiHtml = Emoji.getEmojiFromId(emojiId);
|
||||
if (emojiHtml) {
|
||||
tooltip += emojiHtml;
|
||||
}
|
||||
return tooltip
|
||||
}
|
||||
|
||||
Row {
|
||||
|
|
|
@ -71,4 +71,25 @@ QtObject {
|
|||
})
|
||||
return String.fromCodePoint(...codePointParts);
|
||||
}
|
||||
|
||||
function getShortcodeFromId(emojiId) {
|
||||
switch (emojiId) {
|
||||
case 1: return ":heart:"
|
||||
case 2: return ":thumbsup:"
|
||||
case 3: return ":thumbsdown:"
|
||||
case 4: return ":laughing:"
|
||||
case 5: return ":cry:"
|
||||
case 6: return ":angry:"
|
||||
default: return undefined
|
||||
}
|
||||
}
|
||||
|
||||
function getEmojiFromId(emojiId) {
|
||||
let shortcode = Emoji.getShortcodeFromId(emojiId)
|
||||
let emojiUnicode = Emoji.getEmojiUnicode(shortcode)
|
||||
if (emojiUnicode) {
|
||||
return Emoji.fromCodePoint(emojiUnicode)
|
||||
}
|
||||
return undefined
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue