From c777c2ed042e100cbb648de6f9bdb33db93ce32f Mon Sep 17 00:00:00 2001 From: Johann150 Date: Fri, 28 Oct 2022 23:39:39 +0200 Subject: [PATCH] fix: perform visibility query in second stage --- .../api/common/generate-visibility-query.ts | 19 ++++++++++++------- .../backend/src/server/api/common/getters.ts | 6 ++---- .../server/api/endpoints/antennas/notes.ts | 5 ++--- .../src/server/api/endpoints/clips/notes.ts | 5 ++--- .../server/api/endpoints/notes/children.ts | 5 ++--- .../api/endpoints/notes/hybrid-timeline.ts | 5 ++--- .../api/endpoints/notes/local-timeline.ts | 5 ++--- .../server/api/endpoints/notes/mentions.ts | 5 ++--- .../src/server/api/endpoints/notes/renotes.ts | 5 ++--- .../src/server/api/endpoints/notes/replies.ts | 5 ++--- .../api/endpoints/notes/search-by-tag.ts | 5 ++--- .../src/server/api/endpoints/notes/search.ts | 5 ++--- .../server/api/endpoints/notes/timeline.ts | 5 ++--- .../api/endpoints/notes/user-list-timeline.ts | 6 ++---- .../src/server/api/endpoints/users/notes.ts | 5 ++--- .../server/api/endpoints/users/reactions.ts | 6 ++---- 16 files changed, 42 insertions(+), 55 deletions(-) diff --git a/packages/backend/src/server/api/common/generate-visibility-query.ts b/packages/backend/src/server/api/common/generate-visibility-query.ts index 26df89b2c..7094742e6 100644 --- a/packages/backend/src/server/api/common/generate-visibility-query.ts +++ b/packages/backend/src/server/api/common/generate-visibility-query.ts @@ -1,12 +1,17 @@ -import { Brackets, SelectQueryBuilder } from 'typeorm'; +import { SelectQueryBuilder } from 'typeorm'; import { User } from '@/models/entities/user.js'; -import { Followings } from '@/models/index.js'; +import { Note } from '@/models/entities/note.js'; +import { Notes } from '@/models/index.js'; -export function generateVisibilityQuery(q: SelectQueryBuilder, me?: { id: User['id'] } | null) { - if (me == null) { - q.andWhere('note_visible(note.id, null)'); +export function visibilityQuery(q: SelectQueryBuilder, meId?: User['id'] | null = null): SelectQueryBuilder { + const superQuery = Notes.createQueryBuilder() + .from(() => q, 'note'); + + if (meId == null) { + superQuery.where('note_visible(note.id, null);'); } else { - q.andWhere('note_visible(note.id, :meId)'); - q.setParameters({ meId: me.id }); + superQuery.where('note_visible(note.id, :meId)', { meId }); } + + return q; } diff --git a/packages/backend/src/server/api/common/getters.ts b/packages/backend/src/server/api/common/getters.ts index f5fba27f6..ca0fbf1ef 100644 --- a/packages/backend/src/server/api/common/getters.ts +++ b/packages/backend/src/server/api/common/getters.ts @@ -2,7 +2,7 @@ import { IdentifiableError } from '@/misc/identifiable-error.js'; import { User } from '@/models/entities/user.js'; import { Note } from '@/models/entities/note.js'; import { Notes, Users } from '@/models/index.js'; -import { generateVisibilityQuery } from './generate-visibility-query.js'; +import { visibilityQuery } from './generate-visibility-query.js'; /** * Get note for API processing, taking into account visibility. @@ -13,9 +13,7 @@ export async function getNote(noteId: Note['id'], me: { id: User['id'] } | null) id: noteId, }); - generateVisibilityQuery(query, me); - - const note = await query.getOne(); + const note = await visibilityQuery(query, me).getOne(); if (note == null) { throw new IdentifiableError('9725d0ce-ba28-4dde-95a7-2cbb2c15de24', 'No such note.'); diff --git a/packages/backend/src/server/api/endpoints/antennas/notes.ts b/packages/backend/src/server/api/endpoints/antennas/notes.ts index 24623fb9b..5350e351f 100644 --- a/packages/backend/src/server/api/endpoints/antennas/notes.ts +++ b/packages/backend/src/server/api/endpoints/antennas/notes.ts @@ -1,7 +1,7 @@ import { readNote } from '@/services/note/read.js'; import { Antennas, Notes, AntennaNotes } from '@/models/index.js'; import { makePaginationQuery } from '@/server/api/common/make-pagination-query.js'; -import { generateVisibilityQuery } from '@/server/api/common/generate-visibility-query.js'; +import { visibilityQuery } from '@/server/api/common/generate-visibility-query.js'; import { generateMutedUserQuery } from '@/server/api/common/generate-muted-user-query.js'; import { generateBlockedUserQuery } from '@/server/api/common/generate-block-query.js'; import define from '@/server/api/define.js'; @@ -65,11 +65,10 @@ export default define(meta, paramDef, async (ps, user) => { .leftJoinAndSelect('renoteUser.banner', 'renoteUserBanner') .andWhere('antennaNote.antennaId = :antennaId', { antennaId: antenna.id }); - generateVisibilityQuery(query, user); generateMutedUserQuery(query, user); generateBlockedUserQuery(query, user); - const notes = await query + const notes = await visibilityQuery(query, user) .take(ps.limit) .getMany(); diff --git a/packages/backend/src/server/api/endpoints/clips/notes.ts b/packages/backend/src/server/api/endpoints/clips/notes.ts index 267b3dd0e..3afc01242 100644 --- a/packages/backend/src/server/api/endpoints/clips/notes.ts +++ b/packages/backend/src/server/api/endpoints/clips/notes.ts @@ -1,7 +1,7 @@ import { ClipNotes, Clips, Notes } from '@/models/index.js'; import define from '@/server/api/define.js'; import { makePaginationQuery } from '@/server/api/common/make-pagination-query.js'; -import { generateVisibilityQuery } from '@/server/api/common/generate-visibility-query.js'; +import { visibilityQuery } from '@/server/api/common/generate-visibility-query.js'; import { generateMutedUserQuery } from '@/server/api/common/generate-muted-user-query.js'; import { ApiError } from '@/server/api/error.js'; import { generateBlockedUserQuery } from '@/server/api/common/generate-block-query.js'; @@ -65,12 +65,11 @@ export default define(meta, paramDef, async (ps, user) => { .andWhere('clipNote.clipId = :clipId', { clipId: clip.id }); if (user) { - generateVisibilityQuery(query, user); generateMutedUserQuery(query, user); generateBlockedUserQuery(query, user); } - const notes = await query + const notes = await visibilityQuery(query, user) .take(ps.limit) .getMany(); diff --git a/packages/backend/src/server/api/endpoints/notes/children.ts b/packages/backend/src/server/api/endpoints/notes/children.ts index 687e928ca..a3ff249a4 100644 --- a/packages/backend/src/server/api/endpoints/notes/children.ts +++ b/packages/backend/src/server/api/endpoints/notes/children.ts @@ -1,7 +1,7 @@ import { Notes } from '@/models/index.js'; import define from '@/server/api/define.js'; import { makePaginationQuery } from '@/server/api/common/make-pagination-query.js'; -import { generateVisibilityQuery } from '@/server/api/common/generate-visibility-query.js'; +import { visibilityQuery } from '@/server/api/common/generate-visibility-query.js'; import { generateMutedUserQuery } from '@/server/api/common/generate-muted-user-query.js'; import { generateBlockedUserQuery } from '@/server/api/common/generate-block-query.js'; @@ -59,13 +59,12 @@ export default define(meta, paramDef, async (ps, user) => { .andWhere('note.id IN (SELECT id FROM note_replies(:noteId, :depth, :limit))', { noteId: ps.noteId, depth: ps.depth, limit: ps.limit }) .innerJoinAndSelect('note.user', 'user'); - generateVisibilityQuery(query, user); if (user) { generateMutedUserQuery(query, user); generateBlockedUserQuery(query, user); } - const notes = await query.getMany(); + const notes = await visibilityQuery(query, user).getMany(); return await Notes.packMany(notes, user, { detail: false }); }); diff --git a/packages/backend/src/server/api/endpoints/notes/hybrid-timeline.ts b/packages/backend/src/server/api/endpoints/notes/hybrid-timeline.ts index 229d55f94..0e4484e2b 100644 --- a/packages/backend/src/server/api/endpoints/notes/hybrid-timeline.ts +++ b/packages/backend/src/server/api/endpoints/notes/hybrid-timeline.ts @@ -5,7 +5,7 @@ import { activeUsersChart } from '@/services/chart/index.js'; import define from '@/server/api/define.js'; import { ApiError } from '@/server/api/error.js'; import { makePaginationQuery } from '@/server/api/common/make-pagination-query.js'; -import { generateVisibilityQuery } from '@/server/api/common/generate-visibility-query.js'; +import { visibilityQuery } from '@/server/api/common/generate-visibility-query.js'; import { generateMutedUserQuery } from '@/server/api/common/generate-muted-user-query.js'; import { generateRepliesQuery } from '@/server/api/common/generate-replies-query.js'; import { generateMutedNoteQuery } from '@/server/api/common/generate-muted-note-query.js'; @@ -84,7 +84,6 @@ export default define(meta, paramDef, async (ps, user) => { generateChannelQuery(query, user); generateRepliesQuery(query, user); - generateVisibilityQuery(query, user); generateMutedUserQuery(query, user); generateMutedNoteQuery(query, user); generateBlockedUserQuery(query, user); @@ -125,7 +124,7 @@ export default define(meta, paramDef, async (ps, user) => { } //#endregion - const timeline = await query.take(ps.limit).getMany(); + const timeline = await visibilityQuery(query, user).take(ps.limit).getMany(); process.nextTick(() => { activeUsersChart.read(user); diff --git a/packages/backend/src/server/api/endpoints/notes/local-timeline.ts b/packages/backend/src/server/api/endpoints/notes/local-timeline.ts index 74b1b808a..dedfd2929 100644 --- a/packages/backend/src/server/api/endpoints/notes/local-timeline.ts +++ b/packages/backend/src/server/api/endpoints/notes/local-timeline.ts @@ -6,7 +6,7 @@ import define from '@/server/api/define.js'; import { ApiError } from '@/server/api/error.js'; import { generateMutedUserQuery } from '@/server/api/common/generate-muted-user-query.js'; import { makePaginationQuery } from '@/server/api/common/make-pagination-query.js'; -import { generateVisibilityQuery } from '@/server/api/common/generate-visibility-query.js'; +import { visibilityQuery } from '@/server/api/common/generate-visibility-query.js'; import { generateRepliesQuery } from '@/server/api/common/generate-replies-query.js'; import { generateMutedNoteQuery } from '@/server/api/common/generate-muted-note-query.js'; import { generateChannelQuery } from '@/server/api/common/generate-channel-query.js'; @@ -77,7 +77,6 @@ export default define(meta, paramDef, async (ps, user) => { generateChannelQuery(query, user); generateRepliesQuery(query, user); - generateVisibilityQuery(query, user); if (user) generateMutedUserQuery(query, user); if (user) generateMutedNoteQuery(query, user); if (user) generateBlockedUserQuery(query, user); @@ -103,7 +102,7 @@ export default define(meta, paramDef, async (ps, user) => { } //#endregion - const timeline = await query.take(ps.limit).getMany(); + const timeline = await visibilityQuery(query, user).take(ps.limit).getMany(); process.nextTick(() => { if (user) { diff --git a/packages/backend/src/server/api/endpoints/notes/mentions.ts b/packages/backend/src/server/api/endpoints/notes/mentions.ts index 7ef6ae294..704e05a16 100644 --- a/packages/backend/src/server/api/endpoints/notes/mentions.ts +++ b/packages/backend/src/server/api/endpoints/notes/mentions.ts @@ -3,7 +3,7 @@ import { noteVisibilities } from 'foundkey-js'; import { readNote } from '@/services/note/read.js'; import { Notes, Followings } from '@/models/index.js'; import define from '@/server/api/define.js'; -import { generateVisibilityQuery } from '@/server/api/common/generate-visibility-query.js'; +import { visibilityQuery } from '@/server/api/common/generate-visibility-query.js'; import { generateMutedUserQuery } from '@/server/api/common/generate-muted-user-query.js'; import { makePaginationQuery } from '@/server/api/common/make-pagination-query.js'; import { generateBlockedUserQuery } from '@/server/api/common/generate-block-query.js'; @@ -63,7 +63,6 @@ export default define(meta, paramDef, async (ps, user) => { .leftJoinAndSelect('renoteUser.avatar', 'renoteUserAvatar') .leftJoinAndSelect('renoteUser.banner', 'renoteUserBanner'); - generateVisibilityQuery(query, user); generateMutedUserQuery(query, user); generateMutedNoteThreadQuery(query, user); generateBlockedUserQuery(query, user); @@ -77,7 +76,7 @@ export default define(meta, paramDef, async (ps, user) => { query.setParameters(followingQuery.getParameters()); } - const mentions = await query.take(ps.limit).getMany(); + const mentions = await visibilityQuery(query, user).take(ps.limit).getMany(); readNote(user.id, mentions); diff --git a/packages/backend/src/server/api/endpoints/notes/renotes.ts b/packages/backend/src/server/api/endpoints/notes/renotes.ts index 801bf97b8..1007cc87a 100644 --- a/packages/backend/src/server/api/endpoints/notes/renotes.ts +++ b/packages/backend/src/server/api/endpoints/notes/renotes.ts @@ -2,7 +2,7 @@ import { Notes } from '@/models/index.js'; import define from '@/server/api/define.js'; import { getNote } from '@/server/api/common/getters.js'; import { ApiError } from '@/server/api/error.js'; -import { generateVisibilityQuery } from '@/server/api/common/generate-visibility-query.js'; +import { visibilityQuery } from '@/server/api/common/generate-visibility-query.js'; import { generateMutedUserQuery } from '@/server/api/common/generate-muted-user-query.js'; import { makePaginationQuery } from '@/server/api/common/make-pagination-query.js'; import { generateBlockedUserQuery } from '@/server/api/common/generate-block-query.js'; @@ -63,11 +63,10 @@ export default define(meta, paramDef, async (ps, user) => { .leftJoinAndSelect('renoteUser.avatar', 'renoteUserAvatar') .leftJoinAndSelect('renoteUser.banner', 'renoteUserBanner'); - generateVisibilityQuery(query, user); if (user) generateMutedUserQuery(query, user); if (user) generateBlockedUserQuery(query, user); - const renotes = await query.take(ps.limit).getMany(); + const renotes = await visibilityQuery(query, user).take(ps.limit).getMany(); return await Notes.packMany(renotes, user); }); diff --git a/packages/backend/src/server/api/endpoints/notes/replies.ts b/packages/backend/src/server/api/endpoints/notes/replies.ts index 28426eb9a..1c8b36562 100644 --- a/packages/backend/src/server/api/endpoints/notes/replies.ts +++ b/packages/backend/src/server/api/endpoints/notes/replies.ts @@ -2,7 +2,7 @@ import { Notes } from '@/models/index.js'; import { ApiError } from '@/server/api/error.js'; import define from '@/server/api/define.js'; import { makePaginationQuery } from '@/server/api/common/make-pagination-query.js'; -import { generateVisibilityQuery } from '@/server/api/common/generate-visibility-query.js'; +import { visibilityQuery } from '@/server/api/common/generate-visibility-query.js'; import { generateMutedUserQuery } from '@/server/api/common/generate-muted-user-query.js'; import { generateBlockedUserQuery } from '@/server/api/common/generate-block-query.js'; import { getNote } from '@/server/api/common/getters.js'; @@ -63,11 +63,10 @@ export default define(meta, paramDef, async (ps, user) => { .leftJoinAndSelect('renoteUser.avatar', 'renoteUserAvatar') .leftJoinAndSelect('renoteUser.banner', 'renoteUserBanner'); - generateVisibilityQuery(query, user); if (user) generateMutedUserQuery(query, user); if (user) generateBlockedUserQuery(query, user); - const timeline = await query.take(ps.limit).getMany(); + const timeline = await visibilityQuery(query, user).take(ps.limit).getMany(); return await Notes.packMany(timeline, user); }); diff --git a/packages/backend/src/server/api/endpoints/notes/search-by-tag.ts b/packages/backend/src/server/api/endpoints/notes/search-by-tag.ts index 0f208d546..037090d6e 100644 --- a/packages/backend/src/server/api/endpoints/notes/search-by-tag.ts +++ b/packages/backend/src/server/api/endpoints/notes/search-by-tag.ts @@ -4,7 +4,7 @@ import { normalizeForSearch } from '@/misc/normalize-for-search.js'; import define from '@/server/api/define.js'; import { makePaginationQuery } from '@/server/api/common/make-pagination-query.js'; import { generateMutedUserQuery } from '@/server/api/common/generate-muted-user-query.js'; -import { generateVisibilityQuery } from '@/server/api/common/generate-visibility-query.js'; +import { visibilityQuery } from '@/server/api/common/generate-visibility-query.js'; import { generateBlockedUserQuery } from '@/server/api/common/generate-block-query.js'; export const meta = { @@ -79,7 +79,6 @@ export default define(meta, paramDef, async (ps, me) => { .leftJoinAndSelect('renoteUser.avatar', 'renoteUserAvatar') .leftJoinAndSelect('renoteUser.banner', 'renoteUserBanner'); - generateVisibilityQuery(query, me); if (me) generateMutedUserQuery(query, me); if (me) generateBlockedUserQuery(query, me); @@ -132,7 +131,7 @@ export default define(meta, paramDef, async (ps, me) => { } // Search notes - const notes = await query.take(ps.limit).getMany(); + const notes = await visibilityQuery(query, me).take(ps.limit).getMany(); return await Notes.packMany(notes, me); }); diff --git a/packages/backend/src/server/api/endpoints/notes/search.ts b/packages/backend/src/server/api/endpoints/notes/search.ts index 00fe41464..7958175c0 100644 --- a/packages/backend/src/server/api/endpoints/notes/search.ts +++ b/packages/backend/src/server/api/endpoints/notes/search.ts @@ -4,7 +4,7 @@ import config from '@/config/index.js'; import es from '@/db/elasticsearch.js'; import define from '@/server/api/define.js'; import { makePaginationQuery } from '@/server/api/common/make-pagination-query.js'; -import { generateVisibilityQuery } from '@/server/api/common/generate-visibility-query.js'; +import { visibilityQuery } from '@/server/api/common/generate-visibility-query.js'; import { generateMutedUserQuery } from '@/server/api/common/generate-muted-user-query.js'; import { generateBlockedUserQuery } from '@/server/api/common/generate-block-query.js'; @@ -70,11 +70,10 @@ export default define(meta, paramDef, async (ps, me) => { .leftJoinAndSelect('renoteUser.avatar', 'renoteUserAvatar') .leftJoinAndSelect('renoteUser.banner', 'renoteUserBanner'); - generateVisibilityQuery(query, me); if (me) generateMutedUserQuery(query, me); if (me) generateBlockedUserQuery(query, me); - const notes = await query.take(ps.limit).getMany(); + const notes = await visibilityQuery(query, me).take(ps.limit).getMany(); return await Notes.packMany(notes, me); } else { diff --git a/packages/backend/src/server/api/endpoints/notes/timeline.ts b/packages/backend/src/server/api/endpoints/notes/timeline.ts index d535ba458..2c7006248 100644 --- a/packages/backend/src/server/api/endpoints/notes/timeline.ts +++ b/packages/backend/src/server/api/endpoints/notes/timeline.ts @@ -3,7 +3,7 @@ import { Notes, Followings } from '@/models/index.js'; import { activeUsersChart } from '@/services/chart/index.js'; import define from '@/server/api/define.js'; import { makePaginationQuery } from '@/server/api/common/make-pagination-query.js'; -import { generateVisibilityQuery } from '@/server/api/common/generate-visibility-query.js'; +import { visibilityQuery } from '@/server/api/common/generate-visibility-query.js'; import { generateMutedUserQuery } from '@/server/api/common/generate-muted-user-query.js'; import { generateRepliesQuery } from '@/server/api/common/generate-replies-query.js'; import { generateMutedNoteQuery } from '@/server/api/common/generate-muted-note-query.js'; @@ -82,7 +82,6 @@ export default define(meta, paramDef, async (ps, user) => { generateChannelQuery(query, user); generateRepliesQuery(query, user); - generateVisibilityQuery(query, user); generateMutedUserQuery(query, user); generateMutedNoteQuery(query, user); generateBlockedUserQuery(query, user); @@ -123,7 +122,7 @@ export default define(meta, paramDef, async (ps, user) => { } //#endregion - const timeline = await query.take(ps.limit).getMany(); + const timeline = await visibilityQuery(query, user).take(ps.limit).getMany(); process.nextTick(() => { activeUsersChart.read(user); diff --git a/packages/backend/src/server/api/endpoints/notes/user-list-timeline.ts b/packages/backend/src/server/api/endpoints/notes/user-list-timeline.ts index 207239155..962d71b39 100644 --- a/packages/backend/src/server/api/endpoints/notes/user-list-timeline.ts +++ b/packages/backend/src/server/api/endpoints/notes/user-list-timeline.ts @@ -4,7 +4,7 @@ import { activeUsersChart } from '@/services/chart/index.js'; import define from '@/server/api/define.js'; import { ApiError } from '@/server/api/error.js'; import { makePaginationQuery } from '@/server/api/common/make-pagination-query.js'; -import { generateVisibilityQuery } from '@/server/api/common/generate-visibility-query.js'; +import { visibilityQuery } from '@/server/api/common/generate-visibility-query.js'; export const meta = { tags: ['notes', 'lists'], @@ -70,8 +70,6 @@ export default define(meta, paramDef, async (ps, user) => { .leftJoinAndSelect('renoteUser.banner', 'renoteUserBanner') .andWhere('userListJoining.userListId = :userListId', { userListId: list.id }); - generateVisibilityQuery(query, user); - if (ps.includeMyRenotes === false) { query.andWhere(new Brackets(qb => { qb.orWhere('note.userId != :meId', { meId: user.id }); @@ -107,7 +105,7 @@ export default define(meta, paramDef, async (ps, user) => { } //#endregion - const timeline = await query.take(ps.limit).getMany(); + const timeline = await visibilityQuery(query, user).take(ps.limit).getMany(); activeUsersChart.read(user); diff --git a/packages/backend/src/server/api/endpoints/users/notes.ts b/packages/backend/src/server/api/endpoints/users/notes.ts index 400a79e9b..d1570f0c5 100644 --- a/packages/backend/src/server/api/endpoints/users/notes.ts +++ b/packages/backend/src/server/api/endpoints/users/notes.ts @@ -4,7 +4,7 @@ import define from '@/server/api/define.js'; import { ApiError } from '@/server/api/error.js'; import { getUser } from '@/server/api/common/getters.js'; import { makePaginationQuery } from '@/server/api/common/make-pagination-query.js'; -import { generateVisibilityQuery } from '@/server/api/common/generate-visibility-query.js'; +import { visibilityQuery } from '@/server/api/common/generate-visibility-query.js'; import { generateMutedUserQuery } from '@/server/api/common/generate-muted-user-query.js'; import { generateBlockedUserQuery } from '@/server/api/common/generate-block-query.js'; @@ -69,7 +69,6 @@ export default define(meta, paramDef, async (ps, me) => { .leftJoinAndSelect('renoteUser.avatar', 'renoteUserAvatar') .leftJoinAndSelect('renoteUser.banner', 'renoteUserBanner'); - generateVisibilityQuery(query, me); if (me) { generateMutedUserQuery(query, me); generateBlockedUserQuery(query, me); @@ -110,7 +109,7 @@ export default define(meta, paramDef, async (ps, me) => { //#endregion - const timeline = await query.take(ps.limit).getMany(); + const timeline = await visibilityQuery(query, me).take(ps.limit).getMany(); return await Notes.packMany(timeline, me); }); diff --git a/packages/backend/src/server/api/endpoints/users/reactions.ts b/packages/backend/src/server/api/endpoints/users/reactions.ts index 19f230265..ee0f789cc 100644 --- a/packages/backend/src/server/api/endpoints/users/reactions.ts +++ b/packages/backend/src/server/api/endpoints/users/reactions.ts @@ -1,7 +1,7 @@ import { NoteReactions, UserProfiles } from '@/models/index.js'; import define from '@/server/api/define.js'; import { makePaginationQuery } from '@/server/api/common/make-pagination-query.js'; -import { generateVisibilityQuery } from '@/server/api/common/generate-visibility-query.js'; +import { visibilityQuery } from '@/server/api/common/generate-visibility-query.js'; import { ApiError } from '@/server/api/error.js'; export const meta = { @@ -50,9 +50,7 @@ export default define(meta, paramDef, async (ps, me) => { .andWhere('reaction.userId = :userId', { userId: ps.userId }) .leftJoinAndSelect('reaction.note', 'note'); - generateVisibilityQuery(query, me); - - const reactions = await query + const reactions = await visibilityQuery(query, me) .take(ps.limit) .getMany();