From 9e285d8b076a0ac08eac66d8e05d079c89bea0ca Mon Sep 17 00:00:00 2001 From: les Date: Fri, 25 Jun 2021 11:36:28 +0200 Subject: [PATCH] fix AP resource removal --- server/federation/resources.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/server/federation/resources.js b/server/federation/resources.js index 0888e7db..b69fee39 100644 --- a/server/federation/resources.js +++ b/server/federation/resources.js @@ -59,7 +59,7 @@ module.exports = { async remove (req, res) { const resource = await Resource.findOne({ where: { activitypub_id: req.body.object.id }, - include: [{ model: APUser, required: false, attributes: ['ap_id'] }] + include: [{ model: APUser, required: true, attributes: ['ap_id'] }] }) if (!resource) { log.info(`Comment ${req.body.object.id} not found`) @@ -67,8 +67,7 @@ module.exports = { } // check if fedi_user that requested resource removal // is the same that created the resource at first place - log.debug(res.fedi_user.ap_id, resource.ap_user.ap_id) - if (res.fedi_user.ap_id === resource.ap_user.id) { + if (req.fedi_user.ap_id === resource.ap_user.id) { await resource.destroy() log.info(`Comment ${req.body.object.id} removed`) res.sendStatus(201)