mirror of
https://github.com/NodeBB/NodeBB.git
synced 2026-07-04 09:59:38 +02:00
Merge branch 'develop' of https://github.com/NodeBB/NodeBB into develop
This commit is contained in:
@@ -48,6 +48,12 @@ exports.handleErrors = async function handleErrors(err, req, res, next) { // esl
|
||||
res.status(403).type('text/plain').send(err.message);
|
||||
},
|
||||
};
|
||||
|
||||
const notFoundHandler = () => {
|
||||
const controllers = require('.');
|
||||
controllers['404'].handle404(req, res);
|
||||
};
|
||||
|
||||
const defaultHandler = async function () {
|
||||
if (res.headersSent) {
|
||||
return;
|
||||
@@ -87,6 +93,8 @@ exports.handleErrors = async function handleErrors(err, req, res, next) { // esl
|
||||
try {
|
||||
if (data.cases.hasOwnProperty(err.code)) {
|
||||
data.cases[err.code](err, req, res, defaultHandler);
|
||||
} else if (err.message.startsWith('[[error:no-') && err.message !== '[[error:no-privileges]]') {
|
||||
notFoundHandler();
|
||||
} else {
|
||||
await defaultHandler();
|
||||
}
|
||||
|
||||
@@ -13,7 +13,7 @@ Flags.create = async (req, res) => {
|
||||
};
|
||||
|
||||
Flags.get = async (req, res) => {
|
||||
helpers.formatApiResponse(200, res, await api.flags.get(req, req.params.flagId));
|
||||
helpers.formatApiResponse(200, res, await api.flags.get(req, req.params));
|
||||
};
|
||||
|
||||
Flags.update = async (req, res) => {
|
||||
@@ -32,6 +32,11 @@ Flags.delete = async (req, res) => {
|
||||
helpers.formatApiResponse(200, res);
|
||||
};
|
||||
|
||||
Flags.rescind = async (req, res) => {
|
||||
await api.flags.rescind(req, { flagId: req.params.flagId });
|
||||
helpers.formatApiResponse(200, res);
|
||||
};
|
||||
|
||||
Flags.appendNote = async (req, res) => {
|
||||
const { note, datetime } = req.body;
|
||||
const payload = await api.flags.appendNote(req, {
|
||||
|
||||
Reference in New Issue
Block a user