mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-16 02:36:16 +01:00
* Fixes #5572 * Adding trailing commas but in protest
This commit is contained in:
committed by
psychobunny
parent
0fac75c055
commit
da183e196a
@@ -98,7 +98,11 @@ define('forum/chats', [
|
|||||||
}
|
}
|
||||||
loading = true;
|
loading = true;
|
||||||
var start = parseInt($('.chat-content').children('[data-index]').first().attr('data-index'), 10) + 1;
|
var start = parseInt($('.chat-content').children('[data-index]').first().attr('data-index'), 10) + 1;
|
||||||
socket.emit('modules.chats.getMessages', { roomId: roomId, uid: uid, start: start }, function (err, data) {
|
socket.emit('modules.chats.getMessages', {
|
||||||
|
roomId: roomId,
|
||||||
|
uid: uid,
|
||||||
|
start: start,
|
||||||
|
}, function (err, data) {
|
||||||
if (err) {
|
if (err) {
|
||||||
return app.alertError(err.message);
|
return app.alertError(err.message);
|
||||||
}
|
}
|
||||||
@@ -122,7 +126,7 @@ define('forum/chats', [
|
|||||||
Chats.addEditDeleteHandler = function (element, roomId) {
|
Chats.addEditDeleteHandler = function (element, roomId) {
|
||||||
element.on('click', '[data-action="edit"]', function () {
|
element.on('click', '[data-action="edit"]', function () {
|
||||||
var messageId = $(this).parents('[data-mid]').attr('data-mid');
|
var messageId = $(this).parents('[data-mid]').attr('data-mid');
|
||||||
var inputEl = components.get('chat/input');
|
var inputEl = $('[data-roomid="' + roomId + '"] [component="chat/input"]');
|
||||||
messages.prepEdit(inputEl, messageId, roomId);
|
messages.prepEdit(inputEl, messageId, roomId);
|
||||||
}).on('click', '[data-action="delete"]', function () {
|
}).on('click', '[data-action="delete"]', function () {
|
||||||
var messageId = $(this).parents('[data-mid]').attr('data-mid');
|
var messageId = $(this).parents('[data-mid]').attr('data-mid');
|
||||||
@@ -170,7 +174,10 @@ define('forum/chats', [
|
|||||||
if (oldName === newName) {
|
if (oldName === newName) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
socket.emit('modules.chats.renameRoom', { roomId: roomId, newName: newName }, function (err) {
|
socket.emit('modules.chats.renameRoom', {
|
||||||
|
roomId: roomId,
|
||||||
|
newName: newName,
|
||||||
|
}, function (err) {
|
||||||
if (err) {
|
if (err) {
|
||||||
return app.alertError(err.message);
|
return app.alertError(err.message);
|
||||||
}
|
}
|
||||||
@@ -235,10 +242,15 @@ define('forum/chats', [
|
|||||||
if (event.item === app.user.username) {
|
if (event.item === app.user.username) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
socket.emit('modules.chats.addUserToRoom', { roomId: data.roomId, username: event.item }, function (err) {
|
socket.emit('modules.chats.addUserToRoom', {
|
||||||
|
roomId: data.roomId,
|
||||||
|
username: event.item,
|
||||||
|
}, function (err) {
|
||||||
if (err) {
|
if (err) {
|
||||||
app.alertError(err.message);
|
app.alertError(err.message);
|
||||||
tagEl.tagsinput('remove', event.item, { nouser: true });
|
tagEl.tagsinput('remove', event.item, {
|
||||||
|
nouser: true,
|
||||||
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@@ -262,7 +274,10 @@ define('forum/chats', [
|
|||||||
if (event.options && event.options.nouser) {
|
if (event.options && event.options.nouser) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
socket.emit('modules.chats.removeUserFromRoom', { roomId: data.roomId, username: event.item }, function (err) {
|
socket.emit('modules.chats.removeUserFromRoom', {
|
||||||
|
roomId: data.roomId,
|
||||||
|
username: event.item,
|
||||||
|
}, function (err) {
|
||||||
if (err) {
|
if (err) {
|
||||||
return app.alertError(err.message);
|
return app.alertError(err.message);
|
||||||
}
|
}
|
||||||
@@ -319,7 +334,12 @@ define('forum/chats', [
|
|||||||
} else {
|
} else {
|
||||||
var recentEl = components.get('chat/recent');
|
var recentEl = components.get('chat/recent');
|
||||||
templates.parse('partials/chats/recent_room', {
|
templates.parse('partials/chats/recent_room', {
|
||||||
rooms: { roomId: data.roomId, lastUser: data.message.fromUser, usernames: data.message.fromUser.username, unread: true },
|
rooms: {
|
||||||
|
roomId: data.roomId,
|
||||||
|
lastUser: data.message.fromUser,
|
||||||
|
usernames: data.message.fromUser.username,
|
||||||
|
unread: true,
|
||||||
|
},
|
||||||
}, function (html) {
|
}, function (html) {
|
||||||
translator.translate(html, function (translated) {
|
translator.translate(html, function (translated) {
|
||||||
recentEl.prepend(translated);
|
recentEl.prepend(translated);
|
||||||
|
|||||||
@@ -75,7 +75,9 @@ define('chat', [
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
socket.emit('modules.chats.loadRoom', { roomId: data.roomId }, function (err, roomData) {
|
socket.emit('modules.chats.loadRoom', {
|
||||||
|
roomId: data.roomId,
|
||||||
|
}, function (err, roomData) {
|
||||||
if (err) {
|
if (err) {
|
||||||
return app.alertError(err.message);
|
return app.alertError(err.message);
|
||||||
}
|
}
|
||||||
@@ -108,7 +110,10 @@ define('chat', [
|
|||||||
};
|
};
|
||||||
|
|
||||||
module.loadChatsDropdown = function (chatsListEl) {
|
module.loadChatsDropdown = function (chatsListEl) {
|
||||||
socket.emit('modules.chats.getRecentChats', { uid: app.user.uid, after: 0 }, function (err, data) {
|
socket.emit('modules.chats.getRecentChats', {
|
||||||
|
uid: app.user.uid,
|
||||||
|
after: 0,
|
||||||
|
}, function (err, data) {
|
||||||
if (err) {
|
if (err) {
|
||||||
return app.alertError(err.message);
|
return app.alertError(err.message);
|
||||||
}
|
}
|
||||||
@@ -160,7 +165,7 @@ define('chat', [
|
|||||||
var dragged = false;
|
var dragged = false;
|
||||||
|
|
||||||
chatModal.attr('id', 'chat-modal-' + data.roomId);
|
chatModal.attr('id', 'chat-modal-' + data.roomId);
|
||||||
chatModal.attr('roomId', data.roomId);
|
chatModal.attr('data-roomid', data.roomId);
|
||||||
chatModal.attr('intervalId', 0);
|
chatModal.attr('intervalId', 0);
|
||||||
chatModal.attr('UUID', uuid);
|
chatModal.attr('UUID', uuid);
|
||||||
chatModal.css('position', 'fixed');
|
chatModal.css('position', 'fixed');
|
||||||
@@ -208,7 +213,7 @@ define('chat', [
|
|||||||
components.get('chat/input').val(text);
|
components.get('chat/input').val(text);
|
||||||
});
|
});
|
||||||
|
|
||||||
ajaxify.go('user/' + app.user.userslug + '/chats/' + chatModal.attr('roomId'));
|
ajaxify.go('user/' + app.user.userslug + '/chats/' + chatModal.attr('data-roomid'));
|
||||||
module.close(chatModal);
|
module.close(chatModal);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -249,14 +254,14 @@ define('chat', [
|
|||||||
messagesEl.css('height', module.calculateChatListHeight(chatModal));
|
messagesEl.css('height', module.calculateChatListHeight(chatModal));
|
||||||
});
|
});
|
||||||
|
|
||||||
Chats.addRenameHandler(chatModal.attr('roomId'), chatModal.find('[component="chat/room/name"]'));
|
Chats.addRenameHandler(chatModal.attr('data-roomid'), chatModal.find('[component="chat/room/name"]'));
|
||||||
|
|
||||||
Chats.addSendHandlers(chatModal.attr('roomId'), chatModal.find('#chat-message-input'), chatModal.find('#chat-message-send-btn'));
|
Chats.addSendHandlers(chatModal.attr('data-roomid'), chatModal.find('#chat-message-input'), chatModal.find('#chat-message-send-btn'));
|
||||||
|
|
||||||
Chats.createTagsInput(chatModal.find('.users-tag-input'), data);
|
Chats.createTagsInput(chatModal.find('.users-tag-input'), data);
|
||||||
Chats.createAutoComplete(chatModal.find('[component="chat/input"]'));
|
Chats.createAutoComplete(chatModal.find('[component="chat/input"]'));
|
||||||
|
|
||||||
Chats.addScrollHandler(chatModal.attr('roomId'), data.uid, chatModal.find('.chat-content'));
|
Chats.addScrollHandler(chatModal.attr('data-roomid'), data.uid, chatModal.find('.chat-content'));
|
||||||
|
|
||||||
taskbar.push('chat', chatModal.attr('UUID'), {
|
taskbar.push('chat', chatModal.attr('UUID'), {
|
||||||
title: data.roomName || (data.users.length ? data.users[0].username : ''),
|
title: data.roomName || (data.users.length ? data.users[0].username : ''),
|
||||||
@@ -311,7 +316,7 @@ define('chat', [
|
|||||||
ChatsMessages.scrollToBottom(chatModal.find('.chat-content'));
|
ChatsMessages.scrollToBottom(chatModal.find('.chat-content'));
|
||||||
module.bringModalToTop(chatModal);
|
module.bringModalToTop(chatModal);
|
||||||
module.focusInput(chatModal);
|
module.focusInput(chatModal);
|
||||||
socket.emit('modules.chats.markRead', chatModal.attr('roomId'));
|
socket.emit('modules.chats.markRead', chatModal.attr('data-roomid'));
|
||||||
|
|
||||||
var env = utils.findBootstrapEnvironment();
|
var env = utils.findBootstrapEnvironment();
|
||||||
if (env === 'xs' || env === 'sm') {
|
if (env === 'xs' || env === 'sm') {
|
||||||
|
|||||||
Reference in New Issue
Block a user