fix: filter featured collection
Co-authored-by: naskya <m@naskya.net>
This commit is contained in:
parent
e8b21b593a
commit
831b3d4ee2
2 changed files with 19 additions and 5 deletions
|
@ -28,13 +28,19 @@ export default async (ctx: Router.RouterContext) => {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const pinings = await UserNotePinings.find({
|
const pinning = await UserNotePinings.find({
|
||||||
where: { userId: user.id },
|
where: { userId: user.id },
|
||||||
order: { id: "DESC" },
|
order: { id: "DESC" },
|
||||||
});
|
});
|
||||||
|
|
||||||
const pinnedNotes = await Promise.all(
|
const pinnedNotes = (
|
||||||
pinings.map((pining) => Notes.findOneByOrFail({ id: pining.noteId })),
|
await Promise.all(
|
||||||
|
pinning.map((pinnedNote) =>
|
||||||
|
this.notesRepository.findOneByOrFail({ id: pinnedNote.noteId }),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
).filter(
|
||||||
|
(note) => !note.localOnly && ["public", "home"].includes(note.visibility),
|
||||||
);
|
);
|
||||||
|
|
||||||
const renderedNotes = await Promise.all(
|
const renderedNotes = await Promise.all(
|
||||||
|
|
|
@ -57,7 +57,11 @@ export async function addPinned(
|
||||||
} as UserNotePining);
|
} as UserNotePining);
|
||||||
|
|
||||||
// Deliver to remote followers
|
// 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);
|
deliverPinnedChange(user.id, note.id, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -90,7 +94,11 @@ export async function removePinned(
|
||||||
});
|
});
|
||||||
|
|
||||||
// Deliver to remote followers
|
// Deliver to remote followers
|
||||||
if (Users.isLocalUser(user)) {
|
if (
|
||||||
|
Users.isLocalUser(user) &&
|
||||||
|
!note.localOnly &&
|
||||||
|
["public", "home"].includes(note.visibility)
|
||||||
|
) {
|
||||||
deliverPinnedChange(user.id, noteId, false);
|
deliverPinnedChange(user.id, noteId, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue