Skip to content

Node.js based forum software built for the modern web

closes #1557

barisusaklifa1275c03a6f
diff --git a/public/src/modules/composer/tags.js b/public/src/modules/composer/tags.js
index c9e26c6914..4f6a6294f4 100644
--- a/public/src/modules/composer/tags.js
+++ b/public/src/modules/composer/tags.js
@@ -13,7 +13,7 @@ define(function() {
}
tagEl.tagsinput({
- maxTags: 5 // TODO: make configurable
+ maxTags: config.tagsPerTopic
});
addTags(postData.tags, tagEl);
diff --git a/src/controllers/api.js b/src/controllers/api.js
index 501cf0fe60..91accc05f0 100644
--- a/src/controllers/api.js
+++ b/src/controllers/api.js
@@ -32,6 +32,7 @@ apiController.getConfig = function(req, res, next) {
config.disableSocialButtons = parseInt(meta.config.disableSocialButtons, 10) === 1;
config.maxReconnectionAttempts = meta.config.maxReconnectionAttempts || 5;
config.reconnectionDelay = meta.config.reconnectionDelay || 200;
+ config.tagsPerTopic = meta.config.tagsPerTopic || 5;
config.topicsPerPage = meta.config.topicsPerPage || 20;
config.postsPerPage = meta.config.postsPerPage || 20;
config.maximumFileSize = meta.config.maximumFileSize;
diff --git a/src/topics/tags.js b/src/topics/tags.js
index 77cfc27451..492723f750 100644
--- a/src/topics/tags.js
+++ b/src/topics/tags.js
@@ -3,14 +3,16 @@
var async = require('async'),
db = require('../database'),
+ meta = require('../meta'),
utils = require('../../public/src/utils');
module.exports = function(Topics) {
Topics.createTags = function(tags, tid, timestamp, callback) {
if(Array.isArray(tags)) {
+ tags = tags.slice(0, meta.config.tagsPerTopic || 5);
async.each(tags, function(tag, next) {
- tag = utils.removePunctuation(tag.trim().toLowerCase()).substr(0, 20); // TODO: make max length configurable
+ tag = utils.removePunctuation(tag.trim().toLowerCase()).substr(0, meta.config.maximumTagLength || 15);
db.setAdd('topic:' + tid + ':tags', tag);