fix: clip note selector

This commit is contained in:
Namekuji 2023-09-18 21:37:01 -04:00
parent 6eb2f713f7
commit a5980370de
No known key found for this signature in database
GPG key ID: 1D62332C07FBA532

View file

@ -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,