mirror of
https://github.com/NodeBB/NodeBB.git
synced 2026-01-05 23:30:36 +01:00
Merge branch 'master' into develop
This commit is contained in:
@@ -13,14 +13,16 @@ var websockets = require('../index');
|
||||
|
||||
module.exports = function (SocketPosts) {
|
||||
SocketPosts.edit = function (socket, data, callback) {
|
||||
// Trim and remove HTML (latter for composers that send in HTML, like redactor)
|
||||
var contentLen = S(data.content).stripTags().s.trim().length;
|
||||
|
||||
if (!socket.uid) {
|
||||
return callback(new Error('[[error:not-logged-in]]'));
|
||||
} else if (!data || !data.pid || !data.content) {
|
||||
return callback(new Error('[[error:invalid-data]]'));
|
||||
} else if (data.title && data.title.length < parseInt(meta.config.minimumTitleLength, 10)) {
|
||||
}
|
||||
|
||||
// Trim and remove HTML (latter for composers that send in HTML, like redactor)
|
||||
var contentLen = S(data.content).stripTags().s.trim().length;
|
||||
|
||||
if (data.title && data.title.length < parseInt(meta.config.minimumTitleLength, 10)) {
|
||||
return callback(new Error('[[error:title-too-short, ' + meta.config.minimumTitleLength + ']]'));
|
||||
} else if (data.title && data.title.length > parseInt(meta.config.maximumTitleLength, 10)) {
|
||||
return callback(new Error('[[error:title-too-long, ' + meta.config.maximumTitleLength + ']]'));
|
||||
@@ -28,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 (!data.content || contentLen < parseInt(meta.config.minimumPostLength, 10)) {
|
||||
} else if (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 + ']]'));
|
||||
|
||||
Reference in New Issue
Block a user