mirror of
https://github.com/NodeBB/NodeBB.git
synced 2026-02-06 23:00:08 +01:00
Remove useless next calls
This commit is contained in:
@@ -15,6 +15,10 @@ var middleware = require('../middleware');
|
||||
var helpers = module.exports;
|
||||
|
||||
helpers.noScriptErrors = function (req, res, error, httpStatus) {
|
||||
if (req.body.noscript !== 'true') {
|
||||
return res.status(httpStatus).send(error);
|
||||
}
|
||||
|
||||
var middleware = require('../middleware');
|
||||
var httpStatusString = httpStatus.toString();
|
||||
middleware.buildHeader(req, res, function () {
|
||||
|
||||
@@ -301,14 +301,13 @@ Controllers.composePost = function (req, res, next) {
|
||||
topics.reply(data, next);
|
||||
},
|
||||
function (postData, next) {
|
||||
next(null, postData);
|
||||
|
||||
user.updateOnlineUsers(postData.uid);
|
||||
|
||||
res.redirect(nconf.get('relative_path') + '/post/' + postData.pid);
|
||||
},
|
||||
], function (err) {
|
||||
if (err) {
|
||||
req.body.noscript = 'true';
|
||||
return helpers.noScriptErrors(req, res, err.message, 400);
|
||||
}
|
||||
next(err);
|
||||
@@ -324,12 +323,11 @@ Controllers.composePost = function (req, res, next) {
|
||||
topics.post(data, next);
|
||||
},
|
||||
function (result, next) {
|
||||
next(null, result.topicData);
|
||||
|
||||
res.redirect(nconf.get('relative_path') + '/topic/' + result.topicData.slug);
|
||||
},
|
||||
], function (err) {
|
||||
if (err) {
|
||||
req.body.noscript = 'true';
|
||||
return helpers.noScriptErrors(req, res, err.message, 400);
|
||||
}
|
||||
next(err);
|
||||
|
||||
@@ -1,4 +1,12 @@
|
||||
<div class="alert alert-danger">
|
||||
<strong>[[global:400.title]]</strong>
|
||||
<!-- IF error -->
|
||||
<p>{error}</p>
|
||||
<!-- ELSE -->
|
||||
<p>[[global:400.message, {config.relative_path}]]</p>
|
||||
<!-- ENDIF error -->
|
||||
|
||||
<!-- IF returnLink -->
|
||||
<p>[[error:goback]]</p>
|
||||
<!-- ENDIF returnLink -->
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user