feat: have category actor send Announce(Note) activity on posts from that cid

re: #12434
This commit is contained in:
Julian Lam
2024-03-22 14:39:18 -04:00
parent 803975fd97
commit 7df5cabb76
2 changed files with 25 additions and 6 deletions

View File

@@ -104,15 +104,26 @@ activitypubApi.create.post = enabledCheck(async (caller, { pid }) => {
const object = await activitypub.mocks.note(post);
const { targets } = await buildRecipients(object, post.user.uid);
const { cid } = post.category;
const followers = await activitypub.notes.getCategoryFollowers(cid);
const payload = {
type: 'Create',
to: object.to,
cc: object.cc,
object,
const payloads = {
create: {
type: 'Create',
to: object.to,
cc: object.cc,
object,
},
announce: {
type: 'Announce',
to: [`${nconf.get('url')}/category/${cid}/followers`],
cc: [activitypub._constants.publicAddress],
object,
},
};
await activitypub.send('uid', caller.uid, Array.from(targets), payload);
await activitypub.send('uid', caller.uid, Array.from(targets), payloads.create);
await activitypub.send('cid', cid, followers, payloads.announce);
});
activitypubApi.update = {};