非ログイン時にクリップを取得できない問題を修正

This commit is contained in:
syuilo 2020-11-15 17:35:40 +09:00
parent 3f91e33a8c
commit cd34ade638
2 changed files with 8 additions and 6 deletions

View File

@ -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());
if (user) {
generateVisibilityQuery(query, user);
generateMutedUserQuery(query, user);
}
const notes = await query
.take(ps.limit!)

View File

@ -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);
}