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