From 9fc194e3a8810bf3f826928a24ae4de60d858209 Mon Sep 17 00:00:00 2001 From: Opliko Date: Sat, 6 Apr 2024 01:50:39 +0200 Subject: [PATCH] feat: send unique identifiers for note activities --- src/api/activitypub.js | 3 +++ src/api/posts.js | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/api/activitypub.js b/src/api/activitypub.js index 6a7f3e7f1c..9bddb5db92 100644 --- a/src/api/activitypub.js +++ b/src/api/activitypub.js @@ -109,12 +109,14 @@ activitypubApi.create.post = enabledCheck(async (caller, { pid }) => { const payloads = { create: { + id: `${object.id}#create`, type: 'Create', to: object.to, cc: object.cc, object, }, announce: { + id: `${object.id}#announce`, type: 'Announce', to: [`${nconf.get('url')}/category/${cid}/followers`], cc: [activitypub._constants.publicAddress], @@ -155,6 +157,7 @@ activitypubApi.update.note = enabledCheck(async (caller, { post }) => { } const payload = { + id: `${object.id}#update/${post.edited}`, type: 'Update', to: object.to, cc: object.cc, diff --git a/src/api/posts.js b/src/api/posts.js index 4533b4464c..f810f725db 100644 --- a/src/api/posts.js +++ b/src/api/posts.js @@ -134,7 +134,7 @@ postsAPI.edit = async function (caller, data) { newTitle: validator.escape(String(editResult.topic.title)), }); } - const postObj = await posts.getPostSummaryByPids([editResult.post.pid], caller.uid, {}); + const postObj = await posts.getPostSummaryByPids([editResult.post.pid], caller.uid, { extraFields: ['edited']}); const returnData = { ...postObj[0], ...editResult.post }; returnData.topic = { ...postObj[0].topic, ...editResult.post.topic };