mirror of
https://git.joinsharkey.org/Sharkey/Sharkey.git
synced 2024-11-30 12:53:09 +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) => {
|
export default define(meta, async (ps, user) => {
|
||||||
const clip = await Clips.findOne({
|
const clip = await Clips.findOne({
|
||||||
id: ps.clipId,
|
id: ps.clipId,
|
||||||
userId: user.id
|
|
||||||
});
|
});
|
||||||
|
|
||||||
if (clip == null) {
|
if (clip == null) {
|
||||||
throw new ApiError(meta.errors.noSuchClip);
|
throw new ApiError(meta.errors.noSuchClip);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!clip.isPublic && (clip.userId !== user.id)) {
|
||||||
|
throw new ApiError(meta.errors.noSuchClip);
|
||||||
|
}
|
||||||
|
|
||||||
const clipQuery = ClipNotes.createQueryBuilder('joining')
|
const clipQuery = ClipNotes.createQueryBuilder('joining')
|
||||||
.select('joining.noteId')
|
.select('joining.noteId')
|
||||||
.where('joining.clipId = :clipId', { clipId: clip.id });
|
.where('joining.clipId = :clipId', { clipId: clip.id });
|
||||||
|
|
|
@ -30,12 +30,15 @@ export default define(meta, async (ps, me) => {
|
||||||
// Fetch the clip
|
// Fetch the clip
|
||||||
const clip = await Clips.findOne({
|
const clip = await Clips.findOne({
|
||||||
id: ps.clipId,
|
id: ps.clipId,
|
||||||
userId: me.id,
|
|
||||||
});
|
});
|
||||||
|
|
||||||
if (clip == null) {
|
if (clip == null) {
|
||||||
throw new ApiError(meta.errors.noSuchClip);
|
throw new ApiError(meta.errors.noSuchClip);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!clip.isPublic && (clip.userId !== me.id)) {
|
||||||
|
throw new ApiError(meta.errors.noSuchClip);
|
||||||
|
}
|
||||||
|
|
||||||
return await Clips.pack(clip);
|
return await Clips.pack(clip);
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue