mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-10-26 16:46:12 +01:00
fix: move call to retrieve cid followers out of loop
This commit is contained in:
@@ -158,6 +158,8 @@ 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;
|
||||||
@@ -170,11 +172,8 @@ Notes.assert = async (uid, input, options = { skipChecks: false }) => {
|
|||||||
]);
|
]);
|
||||||
|
|
||||||
// Category announce
|
// Category announce
|
||||||
if (object && object.id === post.pid) {
|
if (cidFollowers.length && object && object.id === post.pid) {
|
||||||
// eslint-disable-next-line no-await-in-loop
|
activitypub.send('cid', cid, cidFollowers, {
|
||||||
const followers = await activitypub.notes.getCategoryFollowers(cid);
|
|
||||||
// eslint-disable-next-line no-await-in-loop
|
|
||||||
await activitypub.send('cid', cid, followers, {
|
|
||||||
id: `${object.id}#activity/announce/${Date.now()}`,
|
id: `${object.id}#activity/announce/${Date.now()}`,
|
||||||
type: 'Announce',
|
type: 'Announce',
|
||||||
to: [`${nconf.get('url')}/category/${cid}/followers`],
|
to: [`${nconf.get('url')}/category/${cid}/followers`],
|
||||||
|
|||||||
Reference in New Issue
Block a user