mirror of
				https://github.com/NodeBB/NodeBB.git
				synced 2025-10-31 19:15:58 +01:00 
			
		
		
		
	Fix maximumTagsPerTopic
This commit is contained in:
		| @@ -497,8 +497,6 @@ define('composer', [ | ||||
| 			return composerAlert(post_uuid, '[[error:title-too-long, ' + config.maximumTitleLength + ']]'); | ||||
| 		} else if (checkTitle && !utils.slugify(titleEl.val()).length) { | ||||
| 			return composerAlert(post_uuid, '[[error:invalid-title]]'); | ||||
| 		} else if (checkTitle && tags.getTags(post_uuid) && tags.getTags(post_uuid).length < parseInt(config.minimumTagsPerTopic, 10)) { | ||||
| 			return composerAlert(post_uuid, '[[error:not-enough-tags]]'); | ||||
| 		} else if (bodyEl.val().length < parseInt(config.minimumPostLength, 10)) { | ||||
| 			return composerAlert(post_uuid, '[[error:content-too-short, ' + config.minimumPostLength + ']]'); | ||||
| 		} else if (bodyEl.val().length > parseInt(config.maximumPostLength, 10)) { | ||||
|   | ||||
| @@ -13,7 +13,6 @@ define('composer/tags', function() { | ||||
| 		} | ||||
|  | ||||
| 		tagEl.tagsinput({ | ||||
| 			minTags: config.minimumTagsPerTopic, | ||||
| 			maxTags: config.tagsPerTopic, | ||||
| 			maxChars: config.maximumTagLength, | ||||
| 			confirmKeys: [13, 44], | ||||
|   | ||||
| @@ -56,7 +56,7 @@ apiController.getConfig = function(req, res, next) { | ||||
| 	config.maxReconnectionAttempts = meta.config.maxReconnectionAttempts || 5; | ||||
| 	config.reconnectionDelay = meta.config.reconnectionDelay || 1500; | ||||
| 	config.minimumTagsPerTopic = meta.config.minimumTagsPerTopic || 0; | ||||
| 	config.tagsPerTopic = meta.config.tagsPerTopic || 5; | ||||
| 	config.maximumTagsPerTopic = meta.config.maximumTagsPerTopic || 5; | ||||
| 	config.minimumTagLength = meta.config.minimumTagLength || 3; | ||||
| 	config.maximumTagLength = meta.config.maximumTagLength || 15; | ||||
| 	config.topicsPerPage = meta.config.topicsPerPage || 20; | ||||
|   | ||||
| @@ -296,6 +296,8 @@ module.exports = function(Topics) { | ||||
| 	function checkTagsLength(tags, callback) { | ||||
| 		if (!tags || tags.length < parseInt(meta.config.minimumTagsPerTopic, 10)) { | ||||
| 			return callback(new Error('[[error:not-enough-tags, ' + meta.config.minimumTagsPerTopic + ']]')); | ||||
| 		} else if (tags.length > parseInt(meta.config.maximumTagsPerTopic, 10)) { | ||||
| 			return callback(new Error('[[error:too-many-tags, ' + meta.config.maximumTagsPerTopic + ']]')); | ||||
| 		} | ||||
| 		callback(); | ||||
| 	} | ||||
|   | ||||
| @@ -23,7 +23,7 @@ module.exports = function(Topics) { | ||||
| 				return callback(err); | ||||
| 			} | ||||
|  | ||||
| 			tags = data.tags.slice(0, meta.config.tagsPerTopic || 5); | ||||
| 			tags = data.tags.slice(0, meta.config.maximumTagsPerTopic || 5); | ||||
|  | ||||
| 			async.each(tags, function(tag, next) { | ||||
| 				tag = Topics.cleanUpTag(tag); | ||||
|   | ||||
| @@ -14,8 +14,8 @@ | ||||
| 				<input id="minimumTagsPerTopics" type="text" class="form-control" value="0" data-field="minimumTagsPerTopic"> | ||||
| 			</div> | ||||
| 			<div class="form-group"> | ||||
| 				<label for="tagsPerTopics">Maximum Tags per Topic</label> | ||||
| 				<input id="tagsPerTopics" type="text" class="form-control" value="5" data-field="tagsPerTopic"> | ||||
| 				<label for="maximumTagsPerTopics">Maximum Tags per Topic</label> | ||||
| 				<input id="maximumTagsPerTopics" type="text" class="form-control" value="5" data-field="maximumTagsPerTopic"> | ||||
| 			</div> | ||||
| 			<div class="form-group"> | ||||
| 				<label for="minimumTagLength">Minimum Tag Length</label> | ||||
|   | ||||
		Reference in New Issue
	
	Block a user