mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-02 20:16:04 +01:00
closes #2427
This commit is contained in:
@@ -185,24 +185,26 @@ define('forum/chats', ['components', 'string', 'sounds', 'forum/infinitescroll',
|
|||||||
|
|
||||||
Chats.sendMessage = function(toUid, inputEl) {
|
Chats.sendMessage = function(toUid, inputEl) {
|
||||||
var msg = inputEl.val();
|
var msg = inputEl.val();
|
||||||
if (msg.length) {
|
if (msg.length > config.maximumChatMessageLength) {
|
||||||
inputEl.val('');
|
return app.alertError('[[error:chat-message-too-long]]');
|
||||||
msg = msg + '\n';
|
|
||||||
socket.emit('modules.chats.send', {
|
|
||||||
touid:toUid,
|
|
||||||
message:msg
|
|
||||||
}, function(err) {
|
|
||||||
if (err) {
|
|
||||||
if (err.message === '[[error:email-not-confirmed-chat]]') {
|
|
||||||
return app.showEmailConfirmWarning(err);
|
|
||||||
}
|
|
||||||
return app.alertError(err.message);
|
|
||||||
}
|
|
||||||
|
|
||||||
sounds.play('chat-outgoing');
|
|
||||||
Chats.notifyTyping(toUid, false);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inputEl.val('');
|
||||||
|
msg = msg + '\n';
|
||||||
|
socket.emit('modules.chats.send', {
|
||||||
|
touid:toUid,
|
||||||
|
message:msg
|
||||||
|
}, function(err) {
|
||||||
|
if (err) {
|
||||||
|
if (err.message === '[[error:email-not-confirmed-chat]]') {
|
||||||
|
return app.showEmailConfirmWarning(err);
|
||||||
|
}
|
||||||
|
return app.alertError(err.message);
|
||||||
|
}
|
||||||
|
|
||||||
|
sounds.play('chat-outgoing');
|
||||||
|
Chats.notifyTyping(toUid, false);
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
Chats.scrollToBottom = function(containerEl) {
|
Chats.scrollToBottom = function(containerEl) {
|
||||||
|
|||||||
@@ -440,6 +440,7 @@ define('chat', ['components', 'taskbar', 'string', 'sounds', 'forum/chats', 'tra
|
|||||||
input.off('keypress').on('keypress', function(e) {
|
input.off('keypress').on('keypress', function(e) {
|
||||||
if (e.which === 13 && !e.shiftKey) {
|
if (e.which === 13 && !e.shiftKey) {
|
||||||
Chats.sendMessage(chatModal.attr('touid'), input);
|
Chats.sendMessage(chatModal.attr('touid'), input);
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -54,6 +54,7 @@ apiController.getConfig = function(req, res, next) {
|
|||||||
config.usePagination = parseInt(meta.config.usePagination, 10) === 1;
|
config.usePagination = parseInt(meta.config.usePagination, 10) === 1;
|
||||||
config.disableSocialButtons = parseInt(meta.config.disableSocialButtons, 10) === 1;
|
config.disableSocialButtons = parseInt(meta.config.disableSocialButtons, 10) === 1;
|
||||||
config.disableChat = parseInt(meta.config.disableChat, 10) === 1;
|
config.disableChat = parseInt(meta.config.disableChat, 10) === 1;
|
||||||
|
config.maximumChatMessageLength = parseInt(meta.config.maximumChatMessageLength, 10);
|
||||||
config.maxReconnectionAttempts = meta.config.maxReconnectionAttempts || 5;
|
config.maxReconnectionAttempts = meta.config.maxReconnectionAttempts || 5;
|
||||||
config.reconnectionDelay = meta.config.reconnectionDelay || 1500;
|
config.reconnectionDelay = meta.config.reconnectionDelay || 1500;
|
||||||
config.minimumTagsPerTopic = meta.config.minimumTagsPerTopic || 0;
|
config.minimumTagsPerTopic = meta.config.minimumTagsPerTopic || 0;
|
||||||
|
|||||||
Reference in New Issue
Block a user