[mastodon-client] Fix emoijs on status detail endpoint

This commit is contained in:
Laura Hausmann 2023-09-24 22:19:02 +02:00
parent 6d2ed68a49
commit 5ee1a1e604
No known key found for this signature in database
GPG Key ID: D044E84C5BE01605

View File

@ -25,17 +25,17 @@ export class NoteConverter {
if (!await Notes.isVisibleForMe(note, user?.id ?? null)) if (!await Notes.isVisibleForMe(note, user?.id ?? null))
throw new Error('Cannot encode note not visible for user'); throw new Error('Cannot encode note not visible for user');
const host = note.user?.host ?? null; const host = Promise.resolve(noteUser).then(noteUser => noteUser.host ?? null);
const reactionEmojiNames = Object.keys(note.reactions) const reactionEmojiNames = Object.keys(note.reactions)
.filter((x) => x?.startsWith(":")) .filter((x) => x?.startsWith(":"))
.map((x) => decodeReaction(x).reaction) .map((x) => decodeReaction(x).reaction)
.map((x) => x.replace(/:/g, "")); .map((x) => x.replace(/:/g, ""));
const noteEmoji = populateEmojis( const noteEmoji = Promise.resolve(host).then(async host => populateEmojis(
note.emojis.concat(reactionEmojiNames), note.emojis.concat(reactionEmojiNames),
host, host,
); ));
const reactionCount = NoteReactions.countBy({noteId: note.id}); const reactionCount = NoteReactions.countBy({noteId: note.id});