v1.18.x
barisusakli 10 years ago
parent fa5ac04cd3
commit 2579d2535d

@ -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();
}
};

Loading…
Cancel
Save