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