Merge pull request #4435 from pichalite/issue-4429

add title length check to topic fork process
v1.18.x
Barış Soner Uşaklı 9 years ago
commit 94ea915304

@ -1,14 +1,14 @@
'use strict'; 'use strict';
var async = require('async'), var async = require('async');
winston = require('winston'), var winston = require('winston');
var db = require('../database');
db = require('../database'), var user = require('../user');
user = require('../user'), var posts = require('../posts');
posts = require('../posts'), var privileges = require('../privileges');
privileges = require('../privileges'), var plugins = require('../plugins');
plugins = require('../plugins'); var meta = require('../meta');
module.exports = function(Topics) { module.exports = function(Topics) {
@ -18,8 +18,10 @@ module.exports = function(Topics) {
title = title.trim(); title = title.trim();
} }
if (!title) { if (title.length < parseInt(meta.config.minimumTitleLength, 10)) {
return callback(new Error('[[error:invalid-title]]')); return callback(new Error('[[error:title-too-short, ' + meta.config.minimumTitleLength + ']]'));
} else if (title.length > parseInt(meta.config.maximumTitleLength, 10)) {
return callback(new Error('[[error:title-too-long, ' + meta.config.maximumTitleLength + ']]'));
} }
if (!pids || !pids.length) { if (!pids || !pids.length) {

Loading…
Cancel
Save