From 834c9f2171bca09cec01d97bb4e0f8da05a27ac2 Mon Sep 17 00:00:00 2001 From: Alex Gleason Date: Thu, 23 May 2024 14:20:15 -0500 Subject: [PATCH] reactionsController: filter out non-RGI reactions --- src/controllers/api/reactions.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/controllers/api/reactions.ts b/src/controllers/api/reactions.ts index 995d67d..f88d36e 100644 --- a/src/controllers/api/reactions.ts +++ b/src/controllers/api/reactions.ts @@ -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) => {