From cd34ade6383201d41e9623652e4e10800a91f739 Mon Sep 17 00:00:00 2001 From: syuilo Date: Sun, 15 Nov 2020 17:35:40 +0900 Subject: [PATCH] =?UTF-8?q?=E9=9D=9E=E3=83=AD=E3=82=B0=E3=82=A4=E3=83=B3?= =?UTF-8?q?=E6=99=82=E3=81=AB=E3=82=AF=E3=83=AA=E3=83=83=E3=83=97=E3=82=92?= =?UTF-8?q?=E5=8F=96=E5=BE=97=E3=81=A7=E3=81=8D=E3=81=AA=E3=81=84=E5=95=8F?= =?UTF-8?q?=E9=A1=8C=E3=82=92=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/server/api/endpoints/clips/notes.ts | 10 ++++++---- src/server/api/endpoints/clips/show.ts | 4 ++-- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/server/api/endpoints/clips/notes.ts b/src/server/api/endpoints/clips/notes.ts index 3d66623d63..13983d99f7 100644 --- a/src/server/api/endpoints/clips/notes.ts +++ b/src/server/api/endpoints/clips/notes.ts @@ -10,7 +10,7 @@ import { ApiError } from '../../error'; export const meta = { tags: ['account', 'notes', 'clips'], - requireCredential: true as const, + requireCredential: false as const, kind: 'read:account', @@ -51,7 +51,7 @@ export default define(meta, async (ps, user) => { throw new ApiError(meta.errors.noSuchClip); } - if (!clip.isPublic && (clip.userId !== user.id)) { + if (!clip.isPublic && (user == null || (clip.userId !== user.id))) { throw new ApiError(meta.errors.noSuchClip); } @@ -64,8 +64,10 @@ export default define(meta, async (ps, user) => { .leftJoinAndSelect('note.user', 'user') .setParameters(clipQuery.getParameters()); - generateVisibilityQuery(query, user); - generateMutedUserQuery(query, user); + if (user) { + generateVisibilityQuery(query, user); + generateMutedUserQuery(query, user); + } const notes = await query .take(ps.limit!) diff --git a/src/server/api/endpoints/clips/show.ts b/src/server/api/endpoints/clips/show.ts index 1d4947528a..dc730d64a3 100644 --- a/src/server/api/endpoints/clips/show.ts +++ b/src/server/api/endpoints/clips/show.ts @@ -7,7 +7,7 @@ import { Clips } from '../../../../models'; export const meta = { tags: ['clips', 'account'], - requireCredential: true as const, + requireCredential: false as const, kind: 'read:account', @@ -36,7 +36,7 @@ export default define(meta, async (ps, me) => { throw new ApiError(meta.errors.noSuchClip); } - if (!clip.isPublic && (clip.userId !== me.id)) { + if (!clip.isPublic && (me == null || (clip.userId !== me.id))) { throw new ApiError(meta.errors.noSuchClip); }