mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-16 10:46:14 +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;
|
||||
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) {
|
||||
return app.alertError(err.message);
|
||||
}
|
||||
@@ -122,7 +126,7 @@ define('forum/chats', [
|
||||
Chats.addEditDeleteHandler = function (element, roomId) {
|
||||
element.on('click', '[data-action="edit"]', function () {
|
||||
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);
|
||||
}).on('click', '[data-action="delete"]', function () {
|
||||
var messageId = $(this).parents('[data-mid]').attr('data-mid');
|
||||
@@ -170,7 +174,10 @@ define('forum/chats', [
|
||||
if (oldName === newName) {
|
||||
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) {
|
||||
return app.alertError(err.message);
|
||||
}
|
||||
@@ -235,10 +242,15 @@ define('forum/chats', [
|
||||
if (event.item === app.user.username) {
|
||||
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) {
|
||||
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) {
|
||||
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) {
|
||||
return app.alertError(err.message);
|
||||
}
|
||||
@@ -319,7 +334,12 @@ define('forum/chats', [
|
||||
} else {
|
||||
var recentEl = components.get('chat/recent');
|
||||
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) {
|
||||
translator.translate(html, function (translated) {
|
||||
recentEl.prepend(translated);
|
||||
@@ -341,7 +361,7 @@ define('forum/chats', [
|
||||
};
|
||||
|
||||
Chats.resizeMainWindow = function () {
|
||||
var messagesList = $('.expanded-chat .chat-content');
|
||||
var messagesList = $('.expanded-chat .chat-content');
|
||||
|
||||
if (messagesList.length) {
|
||||
var margin = $('.expanded-chat ul').outerHeight(true) - $('.expanded-chat ul').height();
|
||||
|
||||
@@ -75,7 +75,9 @@ define('chat', [
|
||||
});
|
||||
}
|
||||
} 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) {
|
||||
return app.alertError(err.message);
|
||||
}
|
||||
@@ -108,7 +110,10 @@ define('chat', [
|
||||
};
|
||||
|
||||
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) {
|
||||
return app.alertError(err.message);
|
||||
}
|
||||
@@ -160,7 +165,7 @@ define('chat', [
|
||||
var dragged = false;
|
||||
|
||||
chatModal.attr('id', 'chat-modal-' + data.roomId);
|
||||
chatModal.attr('roomId', data.roomId);
|
||||
chatModal.attr('data-roomid', data.roomId);
|
||||
chatModal.attr('intervalId', 0);
|
||||
chatModal.attr('UUID', uuid);
|
||||
chatModal.css('position', 'fixed');
|
||||
@@ -208,7 +213,7 @@ define('chat', [
|
||||
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);
|
||||
}
|
||||
|
||||
@@ -249,14 +254,14 @@ define('chat', [
|
||||
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.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'), {
|
||||
title: data.roomName || (data.users.length ? data.users[0].username : ''),
|
||||
@@ -311,7 +316,7 @@ define('chat', [
|
||||
ChatsMessages.scrollToBottom(chatModal.find('.chat-content'));
|
||||
module.bringModalToTop(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();
|
||||
if (env === 'xs' || env === 'sm') {
|
||||
|
||||
Reference in New Issue
Block a user