Merge branch 'reactions' into 'main'

reactionsController: filter out non-RGI reactions

See merge request soapbox-pub/ditto!306
This commit is contained in:
Alex Gleason 2024-05-23 19:23:36 +00:00
commit ae271b6505
1 changed files with 3 additions and 2 deletions

View File

@ -96,8 +96,9 @@ const reactionsController: AppController = async (c) => {
}
const events = await store.query([{ kinds: [7], '#e': [id], limit: 100 }])
.then((events) => hydrateEvents({ events, store }))
.then((events) => events.filter((event) => !emoji || event.content === emoji));
.then((events) => events.filter(({ content }) => /^\p{RGI_Emoji}$/v.test(content)))
.then((events) => events.filter((event) => !emoji || event.content === emoji))
.then((events) => hydrateEvents({ events, store }));
/** Events grouped by emoji. */
const byEmoji = events.reduce((acc, event) => {