Skip to content

Node.js based forum software built for the modern web

fix chats

Barış Soner Uşaklı6d8134618fdf
diff --git a/public/src/client/chats.js b/public/src/client/chats.js
index 4766efa6d5..997efa6650 100644
--- a/public/src/client/chats.js
+++ b/public/src/client/chats.js
@@ -189,11 +189,14 @@ define('forum/chats', ['components', 'string', 'sounds', 'forum/infinitescroll',
return app.alertError('[[error:chat-message-too-long]]');
}
+ if (!msg.length) {
+ return;
+ }
+
inputEl.val('');
- msg = msg + '\n';
socket.emit('modules.chats.send', {
- touid:toUid,
- message:msg
+ touid: toUid,
+ message: msg
}, function(err) {
if (err) {
if (err.message === '[[error:email-not-confirmed-chat]]') {
diff --git a/src/controllers/api.js b/src/controllers/api.js
index 4e141bbec4..5af74d2ed6 100644
--- a/src/controllers/api.js
+++ b/src/controllers/api.js
@@ -54,7 +54,7 @@ apiController.getConfig = function(req, res, next) {
config.usePagination = parseInt(meta.config.usePagination, 10) === 1;
config.disableSocialButtons = parseInt(meta.config.disableSocialButtons, 10) === 1;
config.disableChat = parseInt(meta.config.disableChat, 10) === 1;
- config.maximumChatMessageLength = parseInt(meta.config.maximumChatMessageLength, 10);
+ config.maximumChatMessageLength = parseInt(meta.config.maximumChatMessageLength, 10) || 1000;
config.maxReconnectionAttempts = meta.config.maxReconnectionAttempts || 5;
config.reconnectionDelay = meta.config.reconnectionDelay || 1500;
config.minimumTagsPerTopic = meta.config.minimumTagsPerTopic || 0;