mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-10-27 09:06:15 +01:00
feat: 1b12 compatibility
- only Announce activities, not the plain object - Announce the plain object separately, but only for the main post Create
This commit is contained in:
@@ -27,17 +27,30 @@ Feps.announce = async function announce(id, activity) {
|
|||||||
followers.unshift(actor);
|
followers.unshift(actor);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (activity.type === 'Create') {
|
||||||
|
const isMain = await posts.isMain(localId || id);
|
||||||
|
if (isMain) {
|
||||||
|
activitypub.helpers.log(`[activitypub/inbox.announce(1b12)] Announcing plain object (${activity.id}) to followers of cid ${cid}`);
|
||||||
|
await activitypub.send('cid', cid, followers, {
|
||||||
|
id: `${nconf.get('url')}/post/${encodeURIComponent(id)}#activity/announce/${Date.now()}`,
|
||||||
|
type: 'Announce',
|
||||||
|
actor: `${nconf.get('url')}/category/${cid}`,
|
||||||
|
to: [`${nconf.get('url')}/category/${cid}/followers`],
|
||||||
|
cc: [actor, activitypub._constants.publicAddress],
|
||||||
|
object: activity.object,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
activitypub.helpers.log(`[activitypub/inbox.announce(1b12)] Announcing ${activity.type} (${activity.id}) to followers of cid ${cid}`);
|
activitypub.helpers.log(`[activitypub/inbox.announce(1b12)] Announcing ${activity.type} (${activity.id}) to followers of cid ${cid}`);
|
||||||
await Promise.all([activity, activity.object].map(async (object) => {
|
await activitypub.send('cid', cid, followers, {
|
||||||
await activitypub.send('cid', cid, followers, {
|
id: `${nconf.get('url')}/post/${encodeURIComponent(id)}#activity/announce/${Date.now()}`,
|
||||||
id: `${nconf.get('url')}/post/${encodeURIComponent(id)}#activity/announce/${Date.now()}`,
|
type: 'Announce',
|
||||||
type: 'Announce',
|
actor: `${nconf.get('url')}/category/${cid}`,
|
||||||
actor: `${nconf.get('url')}/category/${cid}`,
|
to: [`${nconf.get('url')}/category/${cid}/followers`],
|
||||||
to: [`${nconf.get('url')}/category/${cid}/followers`],
|
cc: [actor, activitypub._constants.publicAddress],
|
||||||
cc: [actor, activitypub._constants.publicAddress],
|
object: activity,
|
||||||
object,
|
});
|
||||||
});
|
|
||||||
}));
|
|
||||||
};
|
};
|
||||||
|
|
||||||
Feps.announceObject = async function announceObject(id) {
|
Feps.announceObject = async function announceObject(id) {
|
||||||
|
|||||||
Reference in New Issue
Block a user