mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-15 18:26:15 +01:00
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)
This commit is contained in:
@@ -471,7 +471,7 @@ define('forum/chats', [
|
|||||||
data.message.self = data.self;
|
data.message.self = data.self;
|
||||||
|
|
||||||
messages.appendChatMessage($('.expanded-chat .chat-content'), data.message);
|
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 + ']');
|
var roomEl = $('[data-roomid=' + data.roomId + ']');
|
||||||
|
|
||||||
if (roomEl.length > 0) {
|
if (roomEl.length > 0) {
|
||||||
@@ -503,6 +503,7 @@ define('forum/chats', [
|
|||||||
socket.on('event:chats.roomRename', function (data) {
|
socket.on('event:chats.roomRename', function (data) {
|
||||||
var roomEl = components.get('chat/recent/room', data.roomId);
|
var roomEl = components.get('chat/recent/room', data.roomId);
|
||||||
var titleEl = roomEl.find('[component="chat/title"]');
|
var titleEl = roomEl.find('[component="chat/title"]');
|
||||||
|
ajaxify.data.roomName = data.newName;
|
||||||
|
|
||||||
titleEl.text(data.newName);
|
titleEl.text(data.newName);
|
||||||
});
|
});
|
||||||
@@ -519,6 +520,7 @@ define('forum/chats', [
|
|||||||
Chats.setActive = function () {
|
Chats.setActive = function () {
|
||||||
if (ajaxify.data.roomId) {
|
if (ajaxify.data.roomId) {
|
||||||
socket.emit('modules.chats.markRead', ajaxify.data.roomId);
|
socket.emit('modules.chats.markRead', ajaxify.data.roomId);
|
||||||
|
$('[data-roomid="' + ajaxify.data.roomId + '"]').toggleClass('unread', false);
|
||||||
$('.expanded-chat input').focus();
|
$('.expanded-chat input').focus();
|
||||||
}
|
}
|
||||||
$('.chats-list li').removeClass('bg-info');
|
$('.chats-list li').removeClass('bg-info');
|
||||||
|
|||||||
@@ -6,11 +6,6 @@ define('forum/chats/recent', function () {
|
|||||||
|
|
||||||
recent.init = function () {
|
recent.init = function () {
|
||||||
require(['forum/chats'], function (Chats) {
|
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 () {
|
$('[component="chat/recent"]').on('click', '[component="chat/recent/room"]', function () {
|
||||||
Chats.switchChat($(this).attr('data-roomid'));
|
Chats.switchChat($(this).attr('data-roomid'));
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -106,7 +106,7 @@ define('chat', [
|
|||||||
socket.on('event:chats.roomRename', function (data) {
|
socket.on('event:chats.roomRename', function (data) {
|
||||||
var newTitle = $('<div/>').html(data.newName).text();
|
var newTitle = $('<div/>').html(data.newName).text();
|
||||||
var modal = module.getModal(data.roomId);
|
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);
|
taskbar.updateTitle('chat', modal.attr('UUID'), newTitle);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user