mirror of
https://git.joinsharkey.org/Sharkey/Sharkey.git
synced 2024-12-28 00:43:16 +02:00
他人のpublicなクリップを取得できない問題を修正
This commit is contained in:
parent
385776dc0f
commit
17cc996288
2 changed files with 8 additions and 2 deletions
|
@ -45,13 +45,16 @@ export const meta = {
|
|||
export default define(meta, async (ps, user) => {
|
||||
const clip = await Clips.findOne({
|
||||
id: ps.clipId,
|
||||
userId: user.id
|
||||
});
|
||||
|
||||
if (clip == null) {
|
||||
throw new ApiError(meta.errors.noSuchClip);
|
||||
}
|
||||
|
||||
if (!clip.isPublic && (clip.userId !== user.id)) {
|
||||
throw new ApiError(meta.errors.noSuchClip);
|
||||
}
|
||||
|
||||
const clipQuery = ClipNotes.createQueryBuilder('joining')
|
||||
.select('joining.noteId')
|
||||
.where('joining.clipId = :clipId', { clipId: clip.id });
|
||||
|
|
|
@ -30,12 +30,15 @@ export default define(meta, async (ps, me) => {
|
|||
// Fetch the clip
|
||||
const clip = await Clips.findOne({
|
||||
id: ps.clipId,
|
||||
userId: me.id,
|
||||
});
|
||||
|
||||
if (clip == null) {
|
||||
throw new ApiError(meta.errors.noSuchClip);
|
||||
}
|
||||
|
||||
if (!clip.isPublic && (clip.userId !== me.id)) {
|
||||
throw new ApiError(meta.errors.noSuchClip);
|
||||
}
|
||||
|
||||
return await Clips.pack(clip);
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue