From a1a7fb77da9b682669ec4e363167139b8f7956e2 Mon Sep 17 00:00:00 2001 From: Opliko Date: Sun, 14 Apr 2024 02:02:17 +0200 Subject: [PATCH] feat: handle Undo(Flag) --- src/activitypub/inbox.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/activitypub/inbox.js b/src/activitypub/inbox.js index 2db29959b4..096c8580bf 100644 --- a/src/activitypub/inbox.js +++ b/src/activitypub/inbox.js @@ -358,6 +358,21 @@ inbox.undo = async (req) => { } notifications.rescind(`announce:post:${id}:uid:${actor}`); + break; + } + case 'Flag': { + if (!Array.isArray(object.object)) { + object.object = [object.object]; + } + await Promise.all(object.object.map(async (subject) => { + const { type, id } = await activitypub.helpers.resolveLocalId(subject.id); + try { + await flags.rescindReport(type, id, actor); + } catch (e) { + reject('Undo', { type: 'Flag', object: [subject] }, actor); + } + })); + break; } } };