From 51c29b034b20d491e3071a1a5ea49a9b447c1118 Mon Sep 17 00:00:00 2001 From: Niko Date: Wed, 16 Feb 2022 14:54:38 +0100 Subject: [PATCH] Make sure a "Reject" event removes "accepted" state (if any) --- api/src/activity/federation.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/api/src/activity/federation.js b/api/src/activity/federation.js index c7a07b8..e94596c 100644 --- a/api/src/activity/federation.js +++ b/api/src/activity/federation.js @@ -39,8 +39,10 @@ module.exports = { if (msg.object.type === 'Follow') { const follow = await db.getAPObject(msg.object.id, 'Follow') if (follow !== null) - await db.table.objects().updateOne({ _id: follow._id }, - { $set: { rejected: true } }) + await db.table.objects().updateOne({ _id: follow._id }, { + $set: { rejected: true }, + $unset: { accepted: 1 }, + }) return true } }