Handle another kind of emojiReaction response

Can't everyone just standardize the responses?
pull/475/head
Lim Chee Aun 2024-04-03 17:58:37 +08:00
rodzic b10e22a9a2
commit d77ba19308
1 zmienionych plików z 19 dodań i 2 usunięć

Wyświetl plik

@ -1943,7 +1943,24 @@ function Status({
{!!emojiReactions?.length && ( {!!emojiReactions?.length && (
<div class="emoji-reactions"> <div class="emoji-reactions">
{emojiReactions.map((emojiReaction) => { {emojiReactions.map((emojiReaction) => {
const { name, count, me } = emojiReaction; const { name, count, me, url, staticUrl } = emojiReaction;
if (url) {
// Some servers return url and staticUrl
return (
<span
class={`emoji-reaction tag ${
me ? '' : 'insignificant'
}`}
>
<CustomEmoji
alt={name}
url={url}
staticUrl={staticUrl}
/>{' '}
{count}
</span>
);
}
const isShortCode = /^:.+?:$/.test(name); const isShortCode = /^:.+?:$/.test(name);
if (isShortCode) { if (isShortCode) {
const emoji = emojis.find( const emoji = emojis.find(
@ -1962,7 +1979,7 @@ function Status({
alt={name} alt={name}
url={emoji.url} url={emoji.url}
staticUrl={emoji.staticUrl} staticUrl={emoji.staticUrl}
/> />{' '}
{count} {count}
</span> </span>
); );