v1.18.x
barisusakli 10 years ago
parent 0cac0692b6
commit 22d6ceab59

@ -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);
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);
});
}
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;

Loading…
Cancel
Save