Skip to content

Node.js based forum software built for the modern web

feat: handle Undo(Flag)

Oplikoa1a7fb77da9b
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;
}
}
};