fix: re-add sending of Announce(Note) for microblog support, #12434

This commit is contained in:
Julian Lam
2024-06-14 13:26:04 -04:00
parent be95b5b122
commit 89d2363d5e

View File

@@ -163,10 +163,19 @@ activitypubApi.create.note = enabledCheck(async (caller, { pid }) => {
cc: [`${nconf.get('url')}/category/${cid}/followers`], cc: [`${nconf.get('url')}/category/${cid}/followers`],
object: payload, object: payload,
}; };
const implicit = {
id: `${object.id}#activity/announce/${Date.now()}`,
type: 'Announce',
to: [activitypub._constants.publicAddress],
cc: [`${nconf.get('url')}/category/${cid}/followers`],
object: payload.object,
};
setTimeout(() => { // Delay sending to avoid potential race condition setTimeout(() => { // Delay sending to avoid potential race condition
activitypub.send('cid', cid, followers, announce) Promise.all([
.catch(err => winston.error(err.stack)); activitypub.send('cid', cid, followers, announce),
activitypub.send('cid', cid, followers, implicit),
]).catch(err => winston.error(err.stack));
}, 5000); }, 5000);
} }
}); });