mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-03 20:45:58 +01:00
closes #2685
This commit is contained in:
@@ -27,6 +27,10 @@
|
||||
"field": "minimumPostLength",
|
||||
"value": 8
|
||||
},
|
||||
{
|
||||
"field": "maximumPostLength",
|
||||
"value": 32767
|
||||
},
|
||||
{
|
||||
"field": "allowGuestSearching",
|
||||
"value": 0
|
||||
|
||||
@@ -46,6 +46,7 @@
|
||||
|
||||
"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-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-long": "Please enter a shorter title. Titles can't be longer than %1 characters.",
|
||||
"invalid-title": "Invalid title!",
|
||||
|
||||
@@ -406,6 +406,8 @@ define('composer', [
|
||||
return composerAlert('[[error:invalid-title]]');
|
||||
} else if (bodyEl.val().length < parseInt(config.minimumPostLength, 10)) {
|
||||
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;
|
||||
|
||||
@@ -23,6 +23,7 @@ apiController.getConfig = function(req, res, next) {
|
||||
config.minimumTitleLength = meta.config.minimumTitleLength;
|
||||
config.maximumTitleLength = meta.config.maximumTitleLength;
|
||||
config.minimumPostLength = meta.config.minimumPostLength;
|
||||
config.minimumPostLength = meta.config.maximumPostLength;
|
||||
config.hasImageUploadPlugin = plugins.hasListeners('filter:uploadImage');
|
||||
config.maximumProfileImageSize = meta.config.maximumProfileImageSize;
|
||||
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 + ']]'));
|
||||
} else if (!data.content || data.content.length < parseInt(meta.config.minimumPostLength, 10)) {
|
||||
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
|
||||
|
||||
@@ -289,6 +289,8 @@ module.exports = function(Topics) {
|
||||
function checkContentLength(content, callback) {
|
||||
if (!content || content.length < parseInt(meta.config.miminumPostLength, 10)) {
|
||||
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();
|
||||
}
|
||||
|
||||
@@ -49,6 +49,10 @@
|
||||
<label>Minimum Post Length</label>
|
||||
<input type="number" class="form-control" value="8" data-field="minimumPostLength">
|
||||
</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">
|
||||
<label>
|
||||
<input type="checkbox" data-field="trackIpPerPost"> <strong>Track IP Address for each post</strong>
|
||||
|
||||
Reference in New Issue
Block a user