mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-01 11:35:55 +01:00
closes #2685
This commit is contained in:
@@ -27,6 +27,10 @@
|
|||||||
"field": "minimumPostLength",
|
"field": "minimumPostLength",
|
||||||
"value": 8
|
"value": 8
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"field": "maximumPostLength",
|
||||||
|
"value": 32767
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"field": "allowGuestSearching",
|
"field": "allowGuestSearching",
|
||||||
"value": 0
|
"value": 0
|
||||||
|
|||||||
@@ -46,6 +46,7 @@
|
|||||||
|
|
||||||
"still-uploading": "Please wait for uploads to complete.",
|
"still-uploading": "Please wait for uploads to complete.",
|
||||||
"content-too-short": "Please enter a longer post. Posts should contain at least %1 characters.",
|
"content-too-short": "Please enter a longer post. Posts should contain at least %1 characters.",
|
||||||
|
"content-too-long": "Please enter a shorter post. Posts can't be longer than %1 characters.",
|
||||||
"title-too-short": "Please enter a longer title. Titles should contain at least %1 characters.",
|
"title-too-short": "Please enter a longer title. Titles should contain at least %1 characters.",
|
||||||
"title-too-long": "Please enter a shorter title. Titles can't be longer than %1 characters.",
|
"title-too-long": "Please enter a shorter title. Titles can't be longer than %1 characters.",
|
||||||
"invalid-title": "Invalid title!",
|
"invalid-title": "Invalid title!",
|
||||||
|
|||||||
@@ -406,6 +406,8 @@ define('composer', [
|
|||||||
return composerAlert('[[error:invalid-title]]');
|
return composerAlert('[[error:invalid-title]]');
|
||||||
} else if (bodyEl.val().length < parseInt(config.minimumPostLength, 10)) {
|
} else if (bodyEl.val().length < parseInt(config.minimumPostLength, 10)) {
|
||||||
return composerAlert('[[error:content-too-short, ' + config.minimumPostLength + ']]');
|
return composerAlert('[[error:content-too-short, ' + config.minimumPostLength + ']]');
|
||||||
|
} else if (bodyEl.val().length > parseInt(config.maximumPostLength, 10)) {
|
||||||
|
return composerAlert('[[error:content-too-long, ' + config.maximumPostLength + ']]');
|
||||||
}
|
}
|
||||||
|
|
||||||
var composerData = {}, action;
|
var composerData = {}, action;
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ apiController.getConfig = function(req, res, next) {
|
|||||||
config.minimumTitleLength = meta.config.minimumTitleLength;
|
config.minimumTitleLength = meta.config.minimumTitleLength;
|
||||||
config.maximumTitleLength = meta.config.maximumTitleLength;
|
config.maximumTitleLength = meta.config.maximumTitleLength;
|
||||||
config.minimumPostLength = meta.config.minimumPostLength;
|
config.minimumPostLength = meta.config.minimumPostLength;
|
||||||
|
config.minimumPostLength = meta.config.maximumPostLength;
|
||||||
config.hasImageUploadPlugin = plugins.hasListeners('filter:uploadImage');
|
config.hasImageUploadPlugin = plugins.hasListeners('filter:uploadImage');
|
||||||
config.maximumProfileImageSize = meta.config.maximumProfileImageSize;
|
config.maximumProfileImageSize = meta.config.maximumProfileImageSize;
|
||||||
config.minimumUsernameLength = meta.config.minimumUsernameLength;
|
config.minimumUsernameLength = meta.config.minimumUsernameLength;
|
||||||
|
|||||||
@@ -261,6 +261,8 @@ SocketPosts.edit = function(socket, data, callback) {
|
|||||||
return callback(new Error('[[error:title-too-long, ' + meta.config.maximumTitleLength + ']]'));
|
return callback(new Error('[[error:title-too-long, ' + meta.config.maximumTitleLength + ']]'));
|
||||||
} else if (!data.content || data.content.length < parseInt(meta.config.minimumPostLength, 10)) {
|
} else if (!data.content || data.content.length < parseInt(meta.config.minimumPostLength, 10)) {
|
||||||
return callback(new Error('[[error:content-too-short, ' + meta.config.minimumPostLength + ']]'));
|
return callback(new Error('[[error:content-too-short, ' + meta.config.minimumPostLength + ']]'));
|
||||||
|
} else if (data.content.length > parseInt(meta.config.maximumPostLength, 10)) {
|
||||||
|
return callback(new Error('[[error:content-too-long, ' + meta.config.maximumPostLength + ']]'));
|
||||||
}
|
}
|
||||||
|
|
||||||
// uid, pid, title, content, options
|
// uid, pid, title, content, options
|
||||||
|
|||||||
@@ -289,6 +289,8 @@ module.exports = function(Topics) {
|
|||||||
function checkContentLength(content, callback) {
|
function checkContentLength(content, callback) {
|
||||||
if (!content || content.length < parseInt(meta.config.miminumPostLength, 10)) {
|
if (!content || content.length < parseInt(meta.config.miminumPostLength, 10)) {
|
||||||
return callback(new Error('[[error:content-too-short, ' + meta.config.minimumPostLength + ']]'));
|
return callback(new Error('[[error:content-too-short, ' + meta.config.minimumPostLength + ']]'));
|
||||||
|
} else if (content.length > parseInt(meta.config.maximumPostLength, 10)) {
|
||||||
|
return callback(new Error('[[error:content-too-long, ' + meta.config.maximumPostLength + ']]'));
|
||||||
}
|
}
|
||||||
callback();
|
callback();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -49,6 +49,10 @@
|
|||||||
<label>Minimum Post Length</label>
|
<label>Minimum Post Length</label>
|
||||||
<input type="number" class="form-control" value="8" data-field="minimumPostLength">
|
<input type="number" class="form-control" value="8" data-field="minimumPostLength">
|
||||||
</div>
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label>Minimum Post Length</label>
|
||||||
|
<input type="number" class="form-control" value="32767" data-field="maximumPostLength">
|
||||||
|
</div>
|
||||||
<div class="checkbox">
|
<div class="checkbox">
|
||||||
<label>
|
<label>
|
||||||
<input type="checkbox" data-field="trackIpPerPost"> <strong>Track IP Address for each post</strong>
|
<input type="checkbox" data-field="trackIpPerPost"> <strong>Track IP Address for each post</strong>
|
||||||
|
|||||||
Reference in New Issue
Block a user