refactor(api/utils): switch to if...else if for each check
This commit is contained in:
parent
b979b52978
commit
7e300734d8
@ -9,15 +9,17 @@ export default async function (
|
||||
idx: number,
|
||||
) {
|
||||
let ret: any = {};
|
||||
if (story.ficmas != null) {
|
||||
if (!story) {
|
||||
ret.statusCode = 404;
|
||||
ret.message = messages[404];
|
||||
} else if (story.ficmas != null) {
|
||||
if (isFicmasHidden(story)) {
|
||||
ret = {
|
||||
statusCode: 423,
|
||||
message: `TOP SECRET! This story is part of an ongoing challenge. You'll be able to read it after the challenge's reveal date.`,
|
||||
};
|
||||
}
|
||||
}
|
||||
if (
|
||||
} else if (
|
||||
story.chapters[idx]?.hidden &&
|
||||
event.context.currentUser?._id !== story.author._id &&
|
||||
!event.context.currentUser?.profile.isAdmin
|
||||
|
Loading…
Reference in New Issue
Block a user