From 4868c0af580296ec71a5cf3d799aed5fa316c94e Mon Sep 17 00:00:00 2001 From: lesion Date: Mon, 8 Jan 2024 22:59:11 +0100 Subject: [PATCH] fix(AP): return a 201 on Create/Update/Delete --- server/federation/events.js | 4 ++-- server/federation/inbox.js | 1 + server/helpers/ap.js | 3 ++- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/server/federation/events.js b/server/federation/events.js index 842a25a2..eab56a56 100644 --- a/server/federation/events.js +++ b/server/federation/events.js @@ -73,7 +73,7 @@ module.exports = { await event.setTags(tags) } - return event + return res.sendStatus(201) }, @@ -134,7 +134,7 @@ module.exports = { await event.setTags(tags) } - return event + return res.sendStatus(201) }, diff --git a/server/federation/inbox.js b/server/federation/inbox.js index 2cc66dbb..ce514525 100644 --- a/server/federation/inbox.js +++ b/server/federation/inbox.js @@ -79,6 +79,7 @@ module.exports = async (req, res) => { } else { // await Resources.create(req, res) log.warn(`[FEDI] Create with unsupported Object or not a reply => ${message.object.type}`) + return res.sendStatus(404) } break default: diff --git a/server/helpers/ap.js b/server/helpers/ap.js index 722439a5..24753fbd 100644 --- a/server/helpers/ap.js +++ b/server/helpers/ap.js @@ -13,7 +13,8 @@ module.exports = { if (!events.length) { return } - log.info(`Remove ${events.length} past federated events`) + log.info(`Remove ${events.length} past federated events and related resources`) + await Resource.destroy({ where: { eventId: events.map(e => e.id) }}) await Event.destroy({ where: {