mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-02 03:55:55 +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) {
|
||||
var msg = inputEl.val();
|
||||
if (msg.length) {
|
||||
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);
|
||||
});
|
||||
if (msg.length > config.maximumChatMessageLength) {
|
||||
return app.alertError('[[error:chat-message-too-long]]');
|
||||
}
|
||||
|
||||
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) {
|
||||
|
||||
@@ -440,6 +440,7 @@ define('chat', ['components', 'taskbar', 'string', 'sounds', 'forum/chats', 'tra
|
||||
input.off('keypress').on('keypress', function(e) {
|
||||
if (e.which === 13 && !e.shiftKey) {
|
||||
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.disableSocialButtons = parseInt(meta.config.disableSocialButtons, 10) === 1;
|
||||
config.disableChat = parseInt(meta.config.disableChat, 10) === 1;
|
||||
config.maximumChatMessageLength = parseInt(meta.config.maximumChatMessageLength, 10);
|
||||
config.maxReconnectionAttempts = meta.config.maxReconnectionAttempts || 5;
|
||||
config.reconnectionDelay = meta.config.reconnectionDelay || 1500;
|
||||
config.minimumTagsPerTopic = meta.config.minimumTagsPerTopic || 0;
|
||||
|
||||
Reference in New Issue
Block a user