feat: improve custom emoji fallback logic
This commit is contained in:
parent
1fc3632d6e
commit
7e02081c55
1 changed files with 3 additions and 3 deletions
|
|
@ -218,14 +218,14 @@ class NoteStatsService {
|
|||
let emoji: TEmoji | string = evt.content.trim()
|
||||
if (!emoji) return
|
||||
|
||||
if (/^:[a-zA-Z0-9_-]+:$/.test(evt.content)) {
|
||||
if (emoji.startsWith(':') && emoji.endsWith(':')) {
|
||||
const emojiInfos = getEmojiInfosFromEmojiTags(evt.tags)
|
||||
const shortcode = evt.content.split(':')[1]
|
||||
const shortcode = emoji.split(':')[1]
|
||||
const emojiInfo = emojiInfos.find((info) => info.shortcode === shortcode)
|
||||
if (emojiInfo) {
|
||||
emoji = emojiInfo
|
||||
} else {
|
||||
console.log(`Emoji not found for shortcode: ${shortcode}`, emojiInfos)
|
||||
emoji = '+'
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue