fix(api): allow admins to access a hidden story's full contents
This commit is contained in:
parent
37e9bcc17c
commit
3bc828ad5e
@ -8,7 +8,11 @@ export default eventHandler(async (ev) => {
|
||||
isLoggedIn(ev);
|
||||
const s = await storyQuerier(ev);
|
||||
const hidden = s.chapters.some((a) => a.hidden);
|
||||
if (hidden && ev.context.currentUser?._id !== s.author._id) {
|
||||
if (
|
||||
hidden &&
|
||||
ev.context.currentUser?._id !== s.author._id &&
|
||||
!ev.context.currentUser?.profile.isAdmin
|
||||
) {
|
||||
throw createError({
|
||||
statusCode: 403,
|
||||
message: messages[403],
|
||||
|
Loading…
Reference in New Issue
Block a user