mirror of
https://github.com/NodeBB/NodeBB.git
synced 2026-01-28 18:29:50 +01:00
fix: update category sync logic to utilise crossposts instead
This commit is contained in:
@@ -388,12 +388,10 @@ inbox.announce = async (req) => {
|
|||||||
|
|
||||||
// Category sync, remove when cross-posting available
|
// Category sync, remove when cross-posting available
|
||||||
const { cids } = await activitypub.actors.getLocalFollowers(actor);
|
const { cids } = await activitypub.actors.getLocalFollowers(actor);
|
||||||
let cid = null;
|
const syncedCids = Array.from(cids);
|
||||||
if (cids.size > 0) {
|
|
||||||
cid = Array.from(cids)[0];
|
|
||||||
}
|
|
||||||
|
|
||||||
// 1b12 announce
|
// 1b12 announce
|
||||||
|
let cid = null;
|
||||||
const categoryActor = await categories.exists(actor);
|
const categoryActor = await categories.exists(actor);
|
||||||
if (categoryActor) {
|
if (categoryActor) {
|
||||||
cid = actor;
|
cid = actor;
|
||||||
@@ -448,7 +446,7 @@ inbox.announce = async (req) => {
|
|||||||
socketHelpers.sendNotificationToPostOwner(pid, actor, 'announce', 'notifications:activitypub.announce');
|
socketHelpers.sendNotificationToPostOwner(pid, actor, 'announce', 'notifications:activitypub.announce');
|
||||||
} else { // Remote object
|
} else { // Remote object
|
||||||
// Follower check
|
// Follower check
|
||||||
if (!fromRelay && !cid) {
|
if (!fromRelay && !cid && !syncedCids.length) {
|
||||||
const { followers } = await activitypub.actors.getLocalFollowCounts(actor);
|
const { followers } = await activitypub.actors.getLocalFollowCounts(actor);
|
||||||
if (!followers) {
|
if (!followers) {
|
||||||
winston.verbose(`[activitypub/inbox.announce] Rejecting ${object.id} via ${actor} due to no followers`);
|
winston.verbose(`[activitypub/inbox.announce] Rejecting ${object.id} via ${actor} due to no followers`);
|
||||||
@@ -471,6 +469,12 @@ inbox.announce = async (req) => {
|
|||||||
({ tid } = assertion);
|
({ tid } = assertion);
|
||||||
await activitypub.notes.updateLocalRecipients(pid, { to, cc });
|
await activitypub.notes.updateLocalRecipients(pid, { to, cc });
|
||||||
await activitypub.notes.syncUserInboxes(tid);
|
await activitypub.notes.syncUserInboxes(tid);
|
||||||
|
|
||||||
|
if (syncedCids) {
|
||||||
|
await Promise.all(syncedCids.map(async (cid) => {
|
||||||
|
await topics.crossposts.add(tid, cid, 0);
|
||||||
|
}));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!cid) { // Topic events from actors followed by users only
|
if (!cid) { // Topic events from actors followed by users only
|
||||||
|
|||||||
Reference in New Issue
Block a user