From 49598c7af7ac491daf8e8b63ccfac8eec35c8566 Mon Sep 17 00:00:00 2001 From: Cadence Ember Date: Thu, 20 Jun 2024 13:50:38 +1200 Subject: [PATCH] Fix bulk message deletes I have finally e2e tested this function --- d2m/actions/delete-message.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/d2m/actions/delete-message.js b/d2m/actions/delete-message.js index 440e123c..bc8adfb5 100644 --- a/d2m/actions/delete-message.js +++ b/d2m/actions/delete-message.js @@ -33,9 +33,9 @@ async function deleteMessageBulk(data) { if (!roomID) return const sids = JSON.stringify(data.ids) - const eventsToRedact = from("event_message").pluck("event_id").and("WHERE message_id IN (SELECT value FROM json_each(?)").all(sids) - db.prepare("DELETE FROM message_channel WHERE message_id IN (SELECT value FROM json_each(?)").run(sids) - db.prepare("DELETE FROM event_message WHERE message_id IN (SELECT value FROM json_each(?)").run(sids) + const eventsToRedact = from("event_message").pluck("event_id").and("WHERE message_id IN (SELECT value FROM json_each(?))").all(sids) + db.prepare("DELETE FROM message_channel WHERE message_id IN (SELECT value FROM json_each(?))").run(sids) + db.prepare("DELETE FROM event_message WHERE message_id IN (SELECT value FROM json_each(?))").run(sids) for (const eventID of eventsToRedact) { // Awaiting will make it go slower, but since this could be a long-running operation either way, we want to leave rate limit capacity for other operations await api.redactEvent(roomID, eventID)