@@ -21,11 +21,13 @@ var auth = require('./auth.js'),
21
21
logger ,
22
22
23
23
weekMS = ms ( '7d' ) ,
24
+ commentMaxLength = 12e3 ,
24
25
msg = {
25
26
deny : 'У вас нет разрешения на это действие' , //'You do not have permission for this action'
26
27
noObject : 'Комментируемого объекта не существует, или модераторы перевели его в недоступный вам режим' ,
27
28
noComments : 'Операции с комментариями на этой странице запрещены' ,
28
- noCommentExists : 'Комментария не существует'
29
+ noCommentExists : 'Комментария не существует' ,
30
+ maxLength : 'Комментарий длиннее допустимого значения (' + commentMaxLength + ')'
29
31
} ,
30
32
31
33
actionLogController = require ( './actionlog.js' ) ,
@@ -818,6 +820,9 @@ function createComment(socket, data, cb) {
818
820
if ( ! Utils . isType ( 'object' , data ) || ! Number ( data . obj ) || ! data . txt || data . level > 9 ) {
819
821
return cb ( { message : 'Bad params' , error : true } ) ;
820
822
}
823
+ if ( data . txt . length > commentMaxLength ) {
824
+ return cb ( { message : msg . maxLength , error : true } ) ;
825
+ }
821
826
822
827
var iAm = socket . handshake . session . user ,
823
828
cid = Number ( data . obj ) ,
@@ -1297,6 +1302,9 @@ function updateComment(socket, data, cb) {
1297
1302
if ( ! Utils . isType ( 'object' , data ) || ! data . obj || ! Number ( data . cid ) || ! data . txt ) {
1298
1303
return cb ( { message : 'Bad params' , error : true } ) ;
1299
1304
}
1305
+ if ( data . txt . length > commentMaxLength ) {
1306
+ return cb ( { message : msg . maxLength , error : true } ) ;
1307
+ }
1300
1308
var cid = Number ( data . cid ) ,
1301
1309
iAm = socket . handshake . session . user ,
1302
1310
canEdit ,
0 commit comments