mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-10-30 10:35:55 +01:00
closes #1557
This commit is contained in:
@@ -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);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user