Chat fixes

- Fixed issue where clicking into a chat didn't update unread state
- Fixed issue where receiving new messages in chat page didn't mark chat
  unread
- Fixed issue where chat title sets were broken in modal and page
- Removed chat leave toggle in chat list (is now in chat dropdown)
v1.18.x
Julian Lam 7 years ago
parent 9bcd4928c7
commit 8f5dccdfb5

@ -471,7 +471,7 @@ define('forum/chats', [
data.message.self = data.self;
messages.appendChatMessage($('.expanded-chat .chat-content'), data.message);
} else if (ajaxify.currentPage.startsWith('chats')) {
} else if (ajaxify.data.template.chats) {
var roomEl = $('[data-roomid=' + data.roomId + ']');
if (roomEl.length > 0) {
@ -503,6 +503,7 @@ define('forum/chats', [
socket.on('event:chats.roomRename', function (data) {
var roomEl = components.get('chat/recent/room', data.roomId);
var titleEl = roomEl.find('[component="chat/title"]');
ajaxify.data.roomName = data.newName;
titleEl.text(data.newName);
});
@ -519,6 +520,7 @@ define('forum/chats', [
Chats.setActive = function () {
if (ajaxify.data.roomId) {
socket.emit('modules.chats.markRead', ajaxify.data.roomId);
$('[data-roomid="' + ajaxify.data.roomId + '"]').toggleClass('unread', false);
$('.expanded-chat input').focus();
}
$('.chats-list li').removeClass('bg-info');

@ -6,11 +6,6 @@ define('forum/chats/recent', function () {
recent.init = function () {
require(['forum/chats'], function (Chats) {
$('[component="chat/recent"]').on('click', '[component="chat/leave"]', function () {
Chats.leave($(this).parents('[data-roomid]'));
return false;
});
$('[component="chat/recent"]').on('click', '[component="chat/recent/room"]', function () {
Chats.switchChat($(this).attr('data-roomid'));
});

@ -106,7 +106,7 @@ define('chat', [
socket.on('event:chats.roomRename', function (data) {
var newTitle = $('<div/>').html(data.newName).text();
var modal = module.getModal(data.roomId);
modal.find('[component="chat/room/name"]').val(newTitle);
modal.find('[component="chat/room/name"]').text(newTitle);
taskbar.updateTitle('chat', modal.attr('UUID'), newTitle);
});

Loading…
Cancel
Save