fix: commenting out outward federation of Add activity, pending forumwg discussion

This commit is contained in:
Julian Lam
2025-03-28 12:39:19 -04:00
parent 28ec8a79c0
commit 4b22f29778
2 changed files with 25 additions and 25 deletions

View File

@@ -50,7 +50,7 @@ inbox.create = async (req) => {
const asserted = await activitypub.notes.assert(0, object, { cid }); const asserted = await activitypub.notes.assert(0, object, { cid });
if (asserted) { if (asserted) {
activitypub.feps.announce(object.id, req.body); activitypub.feps.announce(object.id, req.body);
api.activitypub.add(req, { pid: object.id }); // api.activitypub.add(req, { pid: object.id });
} }
}; };

View File

@@ -129,7 +129,7 @@ activitypubApi.create.note = enabledCheck(async (caller, { pid, post }) => {
await Promise.all([ await Promise.all([
activitypub.send('uid', caller.uid, Array.from(targets), activity), activitypub.send('uid', caller.uid, Array.from(targets), activity),
activitypub.feps.announce(pid, activity), activitypub.feps.announce(pid, activity),
activitypubApi.add(caller, { pid }), // activitypubApi.add(caller, { pid }),
]); ]);
}); });
@@ -387,32 +387,32 @@ activitypubApi.flag = enabledCheck(async (caller, flag) => {
await db.sortedSetAdd(`flag:${flag.flagId}:remote`, Date.now(), caller.uid); await db.sortedSetAdd(`flag:${flag.flagId}:remote`, Date.now(), caller.uid);
}); });
activitypubApi.add = enabledCheck((async (_, { pid }) => { // activitypubApi.add = enabledCheck((async (_, { pid }) => {
let localId; // let localId;
if (String(pid).startsWith(nconf.get('url'))) { // if (String(pid).startsWith(nconf.get('url'))) {
({ id: localId } = await activitypub.helpers.resolveLocalId(pid)); // ({ id: localId } = await activitypub.helpers.resolveLocalId(pid));
} // }
const tid = await posts.getPostField(localId || pid, 'tid'); // const tid = await posts.getPostField(localId || pid, 'tid');
const cid = await posts.getCidByPid(localId || pid); // const cid = await posts.getCidByPid(localId || pid);
if (!utils.isNumber(tid) || cid <= 0) { // `Add` only federated on categorized topics started locally // if (!utils.isNumber(tid) || cid <= 0) { // `Add` only federated on categorized topics started locally
return; // return;
} // }
let to = [activitypub._constants.publicAddress]; // let to = [activitypub._constants.publicAddress];
let cc = []; // let cc = [];
let targets; // let targets;
({ to, cc, targets } = await activitypub.buildRecipients({ to, cc }, { pid: localId || pid, cid })); // ({ to, cc, targets } = await activitypub.buildRecipients({ to, cc }, { pid: localId || pid, cid }));
await activitypub.send('cid', cid, Array.from(targets), { // await activitypub.send('cid', cid, Array.from(targets), {
id: `${nconf.get('url')}/post/${encodeURIComponent(localId || pid)}#activity/add/${Date.now()}`, // id: `${nconf.get('url')}/post/${encodeURIComponent(localId || pid)}#activity/add/${Date.now()}`,
type: 'Add', // type: 'Add',
to, // to,
cc, // cc,
object: utils.isNumber(pid) ? `${nconf.get('url')}/post/${pid}` : pid, // object: utils.isNumber(pid) ? `${nconf.get('url')}/post/${pid}` : pid,
target: `${nconf.get('url')}/topic/${tid}`, // target: `${nconf.get('url')}/topic/${tid}`,
}); // });
})); // }));
activitypubApi.undo.flag = enabledCheck(async (caller, flag) => { activitypubApi.undo.flag = enabledCheck(async (caller, flag) => {
if (!activitypub.helpers.isUri(flag.targetId)) { if (!activitypub.helpers.isUri(flag.targetId)) {