From ebb88c1277945887062c1e669f5e4a93cbffd2ed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bar=C4=B1=C5=9F=20Soner=20U=C5=9Fakl=C4=B1?= Date: Fri, 30 May 2025 11:45:04 -0400 Subject: [PATCH 1/2] feat: add action:post-queue.save fires after a post is added to the post queue --- src/posts/queue.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/posts/queue.js b/src/posts/queue.js index cc3b1078c8..9f6b21636d 100644 --- a/src/posts/queue.js +++ b/src/posts/queue.js @@ -188,13 +188,16 @@ module.exports = function (Posts) { data: data, }; payload = await plugins.hooks.fire('filter:post-queue.save', payload); - payload.data = JSON.stringify(data); await db.sortedSetAdd('post:queue', now, id); - await db.setObject(`post:queue:${id}`, payload); + await db.setObject(`post:queue:${id}`, { + ...payload, + data: JSON.stringify(payload.data), + }); await user.setUserField(data.uid, 'lastqueuetime', now); cache.del('post-queue'); + await plugins.hooks.fire('action:post-queue.save', payload); const cid = await getCid(type, data); const uids = await getNotificationUids(cid); const bodyLong = await parseBodyLong(cid, type, data); From 629eec7b5b17c55984dd690b281224d9139a57d4 Mon Sep 17 00:00:00 2001 From: Julian Lam Date: Fri, 30 May 2025 16:49:15 -0400 Subject: [PATCH 2/2] =?UTF-8?q?fix:=20add=20try..catch=20wrapper=20around?= =?UTF-8?q?=20Announce(Like)=20call=20to=20internal=20method=20so=20as=20t?= =?UTF-8?q?o=20not=20return=20a=20500=20=E2=80=94=20just=20drop=20the=20Li?= =?UTF-8?q?ke=20activity?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/activitypub/inbox.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/activitypub/inbox.js b/src/activitypub/inbox.js index 0369b11248..9b0f5c6987 100644 --- a/src/activitypub/inbox.js +++ b/src/activitypub/inbox.js @@ -294,9 +294,13 @@ inbox.announce = async (req) => { const { id: localId } = await activitypub.helpers.resolveLocalId(id); const exists = await posts.exists(localId || id); if (exists) { - const result = await posts.upvote(localId || id, object.actor); - if (localId) { - socketHelpers.upvote(result, 'notifications:upvoted-your-post-in'); + try { + const result = await posts.upvote(localId || id, object.actor); + if (localId) { + socketHelpers.upvote(result, 'notifications:upvoted-your-post-in'); + } + } catch (e) { + // vote denied due to local limitations (frequency, privilege, etc.); noop. } }