diff --git a/public/src/utils.js b/public/src/utils.js index 944929e486..7be7618225 100644 --- a/public/src/utils.js +++ b/public/src/utils.js @@ -126,6 +126,9 @@ return str; }, + removePunctuation: function(str) { + return str.replace(/[\.,-\/#!$%\^&\*;:{}=\-_`~()?]/g, ''); + }, isEmailValid: function(email) { return typeof email === 'string' && email.length && email.indexOf('@') !== -1; diff --git a/src/topics/create.js b/src/topics/create.js index 64c95983af..de9b51d87d 100644 --- a/src/topics/create.js +++ b/src/topics/create.js @@ -54,14 +54,13 @@ module.exports = function(Topics) { db.sortedSetAdd('topics:tid', timestamp, tid); plugins.fireHook('action:topic.save', tid); + Topics.createTags(data.tags, tid, timestamp); user.addTopicIdToUser(uid, tid, timestamp); db.sortedSetAdd('categories:' + cid + ':tid', timestamp, tid); db.incrObjectField('category:' + cid, 'topic_count'); db.incrObjectField('global', 'topicCount'); - Topics.createTags(data.tags, tid, timestamp); - callback(null, tid); }); }); diff --git a/src/topics/tags.js b/src/topics/tags.js index 7d36c8c678..275eb2dd94 100644 --- a/src/topics/tags.js +++ b/src/topics/tags.js @@ -2,14 +2,16 @@ 'use strict'; var async = require('async'), - db = require('../database'); + db = require('../database'), + utils = require('../../public/src/utils'); module.exports = function(Topics) { Topics.createTags = function(tags, tid, timestamp) { if(Array.isArray(tags)) { for (var i=0; i