mirror of
https://github.com/NodeBB/NodeBB.git
synced 2026-01-02 13:50:36 +01:00
fixed #5782
This commit is contained in:
@@ -15,7 +15,7 @@ module.exports = function (SocketPosts) {
|
||||
SocketPosts.edit = function (socket, data, callback) {
|
||||
if (!socket.uid) {
|
||||
return callback(new Error('[[error:not-logged-in]]'));
|
||||
} else if (!data || !data.pid || !data.content) {
|
||||
} else if (!data || !data.pid || (parseInt(meta.config.minimumPostLength, 10) !== 0 && !data.content)) {
|
||||
return callback(new Error('[[error:invalid-data]]'));
|
||||
}
|
||||
|
||||
@@ -30,7 +30,7 @@ module.exports = function (SocketPosts) {
|
||||
return callback(new Error('[[error:not-enough-tags, ' + meta.config.minimumTagsPerTopic + ']]'));
|
||||
} else if (data.tags && data.tags.length > parseInt(meta.config.maximumTagsPerTopic, 10)) {
|
||||
return callback(new Error('[[error:too-many-tags, ' + meta.config.maximumTagsPerTopic + ']]'));
|
||||
} else if (contentLen < parseInt(meta.config.minimumPostLength, 10)) {
|
||||
} else if (parseInt(meta.config.minimumPostLength, 10) !== 0 && contentLen < parseInt(meta.config.minimumPostLength, 10)) {
|
||||
return callback(new Error('[[error:content-too-short, ' + meta.config.minimumPostLength + ']]'));
|
||||
} else if (contentLen > parseInt(meta.config.maximumPostLength, 10)) {
|
||||
return callback(new Error('[[error:content-too-long, ' + meta.config.maximumPostLength + ']]'));
|
||||
|
||||
@@ -104,6 +104,11 @@ module.exports = function (Topics) {
|
||||
if (data.content) {
|
||||
data.content = utils.rtrim(data.content);
|
||||
}
|
||||
|
||||
if (parseInt(meta.config.minimumPostLength, 10) === 0) {
|
||||
// Abort if minimum post length is set to 0
|
||||
return setImmediate(next);
|
||||
}
|
||||
check(data.content, meta.config.minimumPostLength, meta.config.maximumPostLength, 'content-too-short', 'content-too-long', next);
|
||||
},
|
||||
function (next) {
|
||||
|
||||
Reference in New Issue
Block a user