mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-07 14:35:47 +01:00
closes #2396
This commit is contained in:
@@ -108,6 +108,9 @@ module.exports = function(Topics) {
|
||||
}
|
||||
|
||||
async.waterfall([
|
||||
function(next) {
|
||||
checkContentLength(content, next);
|
||||
},
|
||||
function(next) {
|
||||
categories.exists(cid, next);
|
||||
},
|
||||
@@ -220,10 +223,9 @@ module.exports = function(Topics) {
|
||||
content = content.trim();
|
||||
}
|
||||
|
||||
if (!content || content.length < parseInt(meta.config.miminumPostLength, 10)) {
|
||||
return callback(new Error('[[error:content-too-short, ' + meta.config.minimumPostLength + ']]'));
|
||||
}
|
||||
|
||||
checkContentLength(content, next);
|
||||
},
|
||||
function(next) {
|
||||
posts.create({uid: uid, tid: tid, content: content, toPid: toPid}, next);
|
||||
},
|
||||
function(data, next) {
|
||||
@@ -277,4 +279,11 @@ module.exports = function(Topics) {
|
||||
], callback);
|
||||
};
|
||||
|
||||
function checkContentLength(content, callback) {
|
||||
if (!content || content.length < parseInt(meta.config.miminumPostLength, 10)) {
|
||||
return callback(new Error('[[error:content-too-short, ' + meta.config.minimumPostLength + ']]'));
|
||||
}
|
||||
callback();
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user