Skip to content

Commit

Permalink
fix: Filter featured collection
Browse files Browse the repository at this point in the history
  • Loading branch information
mei23 committed Dec 26, 2023
1 parent 78173e3 commit 7d48f89
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
5 changes: 3 additions & 2 deletions packages/backend/src/server/activitypub/featured.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,9 @@ export default async (ctx: Router.RouterContext) => {
order: { id: 'DESC' },
});

const pinnedNotes = await Promise.all(pinings.map(pining =>
Notes.findOneByOrFail({ id: pining.noteId })));
const pinnedNotes = (await Promise.all(pinings.map(pining =>
Notes.findOneByOrFail({ id: pining.noteId }))))
.filter(note => !note.localOnly && ['public', 'home'].includes(note.visibility));

const renderedNotes = await Promise.all(pinnedNotes.map(note => renderNote(note)));

Expand Down
4 changes: 2 additions & 2 deletions packages/backend/src/services/i/pin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ export async function addPinned(user: { id: User['id']; host: User['host']; }, n
} 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);
}
}
Expand All @@ -72,7 +72,7 @@ export async function removePinned(user: { id: User['id']; host: User['host']; }
});

// Deliver to remote followers
if (Users.isLocalUser(user)) {
if (Users.isLocalUser(user) && !note.localOnly && ['public', 'home'].includes(note.visibility)) {
deliverPinnedChange(user.id, noteId, false);
}
}
Expand Down

0 comments on commit 7d48f89

Please sign in to comment.