-
Notifications
You must be signed in to change notification settings - Fork 8
Frontend requirements + Maintenance mode #25
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -13,7 +13,7 @@ module.exports = { | |
| if (!tag) { | ||
| throw new Error(tagRemovedError); | ||
| } | ||
| return tag.topics; | ||
| return tag; | ||
| } catch (err) { | ||
| console.log(err); | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. => code observability |
||
| throw err; | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| const Organization = require("../models/organization"); | ||
| const createError = require("http-errors"); | ||
|
|
||
| module.exports = async (req, res, next) => { | ||
| const organization = await Organization.findOne({}).lean(); | ||
| if (organization && organization.isUnderMaintenance) { | ||
| if (req.headers["access-level"] == -1 || (req.currentUser && req.currentUser.isAdmin)) { | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Since it is no longer recommended or is a necessity to prefix custom headers with X-; this name will be good to go |
||
| return next(); | ||
| } else { | ||
| return res.status(500).json({ | ||
| errors: [ | ||
| { | ||
| message: "We are currently under maintenance. Please refresh to continue.", | ||
| }, | ||
| ], | ||
| data: null, | ||
| }); | ||
| } | ||
| } | ||
| next(); | ||
| } | ||
vaibhavdaren marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CO