From f72cf353485ab5c52bb6a0bd299365d76d627fee Mon Sep 17 00:00:00 2001 From: Baris Soner Usakli Date: Mon, 23 Dec 2013 13:59:12 -0500 Subject: [PATCH] closes #680 --- src/postTools.js | 5 +++++ src/websockets.js | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/postTools.js b/src/postTools.js index 217c3d616a..5af411e55e 100644 --- a/src/postTools.js +++ b/src/postTools.js @@ -87,7 +87,12 @@ var winston = require('winston'), posts.getPostField(pid, 'tid', function(err, tid) { PostTools.isMain(pid, tid, function(err, isMainPost) { if (isMainPost) { + title = title.trim(); + var slug = tid + '/' + utils.slugify(title); + topics.setTopicField(tid, 'title', title); + topics.setTopicField(tid, 'slug', slug); + db.searchRemove('topic', tid, function() { db.searchIndex('topic', title, tid); }); diff --git a/src/websockets.js b/src/websockets.js index 6fb17b1f92..13077536c7 100644 --- a/src/websockets.js +++ b/src/websockets.js @@ -623,10 +623,10 @@ websockets.init = function(io) { timeout: 2000 }); return; - } else if (!data.title || data.title.length < topics.minimumTitleLength) { + } else if (!data.title || data.title.length < parseInt(meta.config.minimumTitleLength, 10)) { topics.emitTitleTooShortAlert(socket); return; - } else if (!data.content || data.content.length < require('../public/config.json').minimumPostLength) { + } else if (!data.content || data.content.length < parseInt(meta.config.minimumPostLength, 10)) { posts.emitContentTooShortAlert(socket); return; }