From a5980370deb62b767c3ed0823d623ae1a5361cd9 Mon Sep 17 00:00:00 2001 From: Namekuji Date: Mon, 18 Sep 2023 21:37:01 -0400 Subject: [PATCH] fix: clip note selector --- packages/backend/src/server/api/endpoints/clips/notes.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/packages/backend/src/server/api/endpoints/clips/notes.ts b/packages/backend/src/server/api/endpoints/clips/notes.ts index 19babd99a4..ff5330b9f7 100644 --- a/packages/backend/src/server/api/endpoints/clips/notes.ts +++ b/packages/backend/src/server/api/endpoints/clips/notes.ts @@ -90,9 +90,8 @@ export default define(meta, paramDef, async (ps, user) => { } const noteIds = await ClipNotes.find({ - select: ["noteId"], where: whereOpt, - order: { noteId: "DESC" }, + order: { id: "DESC" }, take: ps.limit * 5, }).then((clips) => clips.map(({ noteId }) => noteId)); @@ -101,6 +100,7 @@ export default define(meta, paramDef, async (ps, user) => { } let [ + followingUserIds, mutedUserIds, mutedInstances, blockerIds, @@ -109,12 +109,14 @@ export default define(meta, paramDef, async (ps, user) => { let mutedWords: string[][]; if (user) { [ + followingUserIds, mutedUserIds, mutedInstances, mutedWords, blockerIds, blockingIds, ] = await Promise.all([ + LocalFollowingsCache.init(user.id).then((cache) => cache.getAll()), UserMutingsCache.init(user.id).then((cache) => cache.getAll()), InstanceMutingsCache.init(user.id).then((cache) => cache.getAll()), userWordMuteCache @@ -133,6 +135,7 @@ export default define(meta, paramDef, async (ps, user) => { const filter = async (notes: ScyllaNote[]) => { let filtered = notes; if (user) { + filtered = await filterVisibility(filtered, user, followingUserIds); filtered = await filterMutedUser( filtered, user,