From 6794ddfb1979d2d40d69ef3b3b8f0d68e1104e57 Mon Sep 17 00:00:00 2001 From: atsu1125 Date: Mon, 4 Dec 2023 20:55:32 +0900 Subject: [PATCH] fix: Filter featured collection --- src/server/activitypub/featured.ts | 5 +++-- src/services/i/pin.ts | 4 ++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/server/activitypub/featured.ts b/src/server/activitypub/featured.ts index 7b87fa109f..818bfb3976 100644 --- a/src/server/activitypub/featured.ts +++ b/src/server/activitypub/featured.ts @@ -28,8 +28,9 @@ export default async (ctx: Router.RouterContext) => { order: { id: 'DESC' } }); - const pinnedNotes = await Promise.all(pinings.map(pining => - Notes.findOne(pining.noteId).then(ensure))); + const pinnedNotes = (await Promise.all(pinings.map(pining => + Notes.findOneOrFail(pining.noteId)))) + .filter(note => !note.localOnly && ['public', 'home'].includes(note.visibility)); const renderedNotes = await Promise.all(pinnedNotes.map(note => renderNote(note))); diff --git a/src/services/i/pin.ts b/src/services/i/pin.ts index 1ff5476b40..7feb439923 100644 --- a/src/services/i/pin.ts +++ b/src/services/i/pin.ts @@ -45,7 +45,7 @@ export async function addPinned(user: User, noteId: Note['id']) { } as UserNotePining); // Deliver to remote followers - if (Users.isLocalUser(user)) { + if (Users.isLocalUser(user) && !note.localOnly && ['public', 'home'].includes(note.visibility)) { deliverPinnedChange(user.id, note.id, true); } } @@ -72,7 +72,7 @@ export async function removePinned(user: User, noteId: Note['id']) { }); // Deliver to remote followers - if (Users.isLocalUser(user)) { + if (Users.isLocalUser(user) && !note.localOnly && ['public', 'home'].includes(note.visibility)) { deliverPinnedChange(user.id, noteId, false); } }