feat: improve custom emoji fallback logic
This commit is contained in:
@@ -218,14 +218,14 @@ class NoteStatsService {
|
|||||||
let emoji: TEmoji | string = evt.content.trim()
|
let emoji: TEmoji | string = evt.content.trim()
|
||||||
if (!emoji) return
|
if (!emoji) return
|
||||||
|
|
||||||
if (/^:[a-zA-Z0-9_-]+:$/.test(evt.content)) {
|
if (emoji.startsWith(':') && emoji.endsWith(':')) {
|
||||||
const emojiInfos = getEmojiInfosFromEmojiTags(evt.tags)
|
const emojiInfos = getEmojiInfosFromEmojiTags(evt.tags)
|
||||||
const shortcode = evt.content.split(':')[1]
|
const shortcode = emoji.split(':')[1]
|
||||||
const emojiInfo = emojiInfos.find((info) => info.shortcode === shortcode)
|
const emojiInfo = emojiInfos.find((info) => info.shortcode === shortcode)
|
||||||
if (emojiInfo) {
|
if (emojiInfo) {
|
||||||
emoji = emojiInfo
|
emoji = emojiInfo
|
||||||
} else {
|
} else {
|
||||||
console.log(`Emoji not found for shortcode: ${shortcode}`, emojiInfos)
|
emoji = '+'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user