v1.18.x
barisusakli 11 years ago
parent 746df87d89
commit fa1275c03a

@ -13,7 +13,7 @@ define(function() {
} }
tagEl.tagsinput({ tagEl.tagsinput({
maxTags: 5 // TODO: make configurable maxTags: config.tagsPerTopic
}); });
addTags(postData.tags, tagEl); addTags(postData.tags, tagEl);

@ -32,6 +32,7 @@ apiController.getConfig = function(req, res, next) {
config.disableSocialButtons = parseInt(meta.config.disableSocialButtons, 10) === 1; config.disableSocialButtons = parseInt(meta.config.disableSocialButtons, 10) === 1;
config.maxReconnectionAttempts = meta.config.maxReconnectionAttempts || 5; config.maxReconnectionAttempts = meta.config.maxReconnectionAttempts || 5;
config.reconnectionDelay = meta.config.reconnectionDelay || 200; config.reconnectionDelay = meta.config.reconnectionDelay || 200;
config.tagsPerTopic = meta.config.tagsPerTopic || 5;
config.topicsPerPage = meta.config.topicsPerPage || 20; config.topicsPerPage = meta.config.topicsPerPage || 20;
config.postsPerPage = meta.config.postsPerPage || 20; config.postsPerPage = meta.config.postsPerPage || 20;
config.maximumFileSize = meta.config.maximumFileSize; config.maximumFileSize = meta.config.maximumFileSize;

@ -3,14 +3,16 @@
var async = require('async'), var async = require('async'),
db = require('../database'), db = require('../database'),
meta = require('../meta'),
utils = require('../../public/src/utils'); utils = require('../../public/src/utils');
module.exports = function(Topics) { module.exports = function(Topics) {
Topics.createTags = function(tags, tid, timestamp, callback) { Topics.createTags = function(tags, tid, timestamp, callback) {
if(Array.isArray(tags)) { if(Array.isArray(tags)) {
tags = tags.slice(0, meta.config.tagsPerTopic || 5);
async.each(tags, function(tag, next) { 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); db.setAdd('topic:' + tid + ':tags', tag);

Loading…
Cancel
Save