fix(api): allow admins to access a hidden story's full contents

This commit is contained in:
parent 37e9bcc17c
commit 3bc828ad5e
Signed by: tablet
GPG Key ID: 924A5F6AF051E87C

@ -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],