Skip to content

Node.js based forum software built for the modern web

fix: update 1b12 rebroadcast logic to send as application actor if post is in remote cid

Julian Lam79d088536a59
diff --git a/src/activitypub/feps.js b/src/activitypub/feps.js
index cc49f2a8aa..36b600283f 100644
--- a/src/activitypub/feps.js
+++ b/src/activitypub/feps.js
@@ -21,12 +21,17 @@ Feps.announce = async function announce(id, activity) {
* - local tids (posted to remote cids) only
*/
const tid = await posts.getPostField(localId || id, 'tid');
- const cid = await topics.getTopicField(tid, 'cid');
- const shouldAnnounce = (utils.isNumber(cid) && cid > 0) || utils.isNumber(tid);
+ let cid = await topics.getTopicField(tid, 'cid');
+ const localCid = utils.isNumber(cid) && cid > 0;
+ const shouldAnnounce = localCid || utils.isNumber(tid);
if (!shouldAnnounce) { // inverse conditionals can kiss my ass.
return;
}
+ if (!localCid) {
+ cid = 0; // override cid to 0 so application actor sends the announce
+ }
+
let relays = await activitypub.relays.list();
relays = relays.reduce((memo, { state, url }) => {
if (state === 2) {
diff --git a/src/activitypub/helpers.js b/src/activitypub/helpers.js
index e6eb2e1c08..90701dd58d 100644
--- a/src/activitypub/helpers.js
+++ b/src/activitypub/helpers.js
@@ -225,7 +225,7 @@ Helpers.resolveActor = (type, id) => {
case 'category':
case 'cid': {
- return `${nconf.get('url')}/category/${id}`;
+ return `${nconf.get('url')}${id > 0 ? `/category/${id}` : '/actor'}`;
}
default: