mirror of
https://git.joinsharkey.org/Sharkey/Sharkey.git
synced 2024-11-23 13:13:08 +02:00
非ログイン時にクリップを取得できない問題を修正
This commit is contained in:
parent
3f91e33a8c
commit
cd34ade638
2 changed files with 8 additions and 6 deletions
|
@ -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!)
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue