mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-02 20:16:04 +01:00
closes #3595
This commit is contained in:
@@ -28,8 +28,6 @@ var db = require('./database'),
|
||||
}
|
||||
|
||||
Messaging.addMessage = function(fromuid, touid, content, timestamp, callback) {
|
||||
var uids = sortUids(fromuid, touid);
|
||||
|
||||
if (typeof timestamp === 'function') {
|
||||
callback = timestamp;
|
||||
timestamp = Date.now();
|
||||
@@ -37,6 +35,16 @@ var db = require('./database'),
|
||||
timestamp = timestamp || Date.now();
|
||||
}
|
||||
|
||||
if (!content) {
|
||||
return callback(new Error('[[error:invalid-chat-message]]'));
|
||||
}
|
||||
|
||||
if (content.length > (meta.config.maximumChatMessageLength || 1000)) {
|
||||
return callback(new Error('[[error:chat-message-too-long]]'));
|
||||
}
|
||||
|
||||
var uids = sortUids(fromuid, touid);
|
||||
|
||||
db.incrObjectField('global', 'nextMid', function(err, mid) {
|
||||
if (err) {
|
||||
return callback(err);
|
||||
|
||||
Reference in New Issue
Block a user