fix: remove duplicate 1b12 announce in notes.assert (already handled in inbox)

This commit is contained in:
Julian Lam
2024-06-26 14:32:48 -04:00
parent fb1a9178cc
commit 4dbb73a433

View File

@@ -33,9 +33,11 @@ Notes.assert = async (uid, input, options = { skipChecks: false }) => {
* retrieving the entire reply tree is not possible at this time. * retrieving the entire reply tree is not possible at this time.
*/ */
const object = !activitypub.helpers.isUri(input) && input; if (!input) {
const id = object ? object.id : input; return null;
}
const id = !activitypub.helpers.isUri(input) ? input.id : input;
const lockStatus = await lock(id, '[[error:activitypub.already-asserting]]'); const lockStatus = await lock(id, '[[error:activitypub.already-asserting]]');
if (!lockStatus) { // unable to achieve lock, stop processing. if (!lockStatus) { // unable to achieve lock, stop processing.
return null; return null;
@@ -153,8 +155,6 @@ Notes.assert = async (uid, input, options = { skipChecks: false }) => {
unprocessed.pop(); unprocessed.pop();
} }
const cidFollowers = await activitypub.notes.getCategoryFollowers(cid);
unprocessed.reverse(); unprocessed.reverse();
for (const post of unprocessed) { for (const post of unprocessed) {
const { to, cc, attachment } = post._activitypub; const { to, cc, attachment } = post._activitypub;
@@ -165,17 +165,6 @@ Notes.assert = async (uid, input, options = { skipChecks: false }) => {
Notes.updateLocalRecipients(post.pid, { to, cc }), Notes.updateLocalRecipients(post.pid, { to, cc }),
posts.attachments.update(post.pid, attachment), posts.attachments.update(post.pid, attachment),
]); ]);
// Category announce
if (cidFollowers.length && object && object.id === post.pid) {
activitypub.send('cid', cid, cidFollowers, {
id: `${object.id}#activity/announce/${Date.now()}`,
type: 'Announce',
to: [`${nconf.get('url')}/category/${cid}/followers`],
cc: [activitypub._constants.publicAddress],
object,
});
}
} }
await Promise.all([ await Promise.all([