Skip to content

Commit

Permalink
fix: re-add sending of Announce(Note) for microblog support, #12434
Browse files Browse the repository at this point in the history
  • Loading branch information
julianlam committed Jun 14, 2024
1 parent be95b5b commit 89d2363
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions src/api/activitypub.js
Original file line number Diff line number Diff line change
Expand Up @@ -163,10 +163,19 @@ activitypubApi.create.note = enabledCheck(async (caller, { pid }) => {
cc: [`${nconf.get('url')}/category/${cid}/followers`],
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
activitypub.send('cid', cid, followers, announce)
.catch(err => winston.error(err.stack));
Promise.all([
activitypub.send('cid', cid, followers, announce),
activitypub.send('cid', cid, followers, implicit),
]).catch(err => winston.error(err.stack));
}, 5000);
}
});
Expand Down

0 comments on commit 89d2363

Please sign in to comment.