use roomName if availabe in taskbar

if room is renamed update title on taskbar
v1.18.x
barisusakli 8 years ago
parent 73879b824c
commit 0b95eab71e

@ -70,7 +70,7 @@ define('chat', [
sounds.play('chat-incoming');
taskbar.push('chat', modal.attr('UUID'), {
title: username,
title: data.roomName || username,
touid: data.message.fromUser.uid,
roomId: data.roomId
});
@ -102,7 +102,10 @@ define('chat', [
});
socket.on('event:chats.roomRename', function (data) {
module.getModal(data.roomId).find('[component="chat/room/name"]').val($('<div/>').html(data.newName).text());
var newTitle = $('<div/>').html(data.newName).text();
var modal = module.getModal(data.roomId);
modal.find('[component="chat/room/name"]').val(newTitle);
taskbar.updateTitle('chat', modal.attr('UUID'), newTitle);
});
ChatsMessages.onChatMessageEdit();
@ -197,7 +200,7 @@ define('chat', [
handle: '.modal-header'
});
});
scrollStop.apply(chatModal.find('[component="chat/messages"]'));
chatModal.find('#chat-close-btn').on('click', function () {

@ -39,7 +39,7 @@ define('taskbar', function () {
taskbar.discard = function (module, uuid) {
var btnEl = taskbar.tasklist.find('[data-module="' + module + '"][data-uuid="' + uuid + '"]');
btnEl.remove();
update();
};
@ -115,7 +115,7 @@ define('taskbar', function () {
.html('<a href="#">' +
(data.options.icon ? '<i class="fa ' + data.options.icon + '"></i> ' : '') +
(data.options.image ? '<img src="' + data.options.image + '"/> ' : '') +
'<span>' + title + '</span>' +
'<span component="taskbar/title">' + title + '</span>' +
'</a>')
.attr({
'data-module': data.module,
@ -136,5 +136,9 @@ define('taskbar', function () {
$(window).trigger('action:taskbar.pushed', data);
}
taskbar.updateTitle = function(module, uuid, newTitle) {
taskbar.tasklist.find('[data-module="' + module + '"][data-uuid="' + uuid + '"] [component="taskbar/title"]').text(newTitle);
};
return taskbar;
});

@ -15,7 +15,14 @@ module.exports = function (Messaging) {
Messaging.notifyQueue = {}; // Only used to notify a user of a new chat message, see Messaging.notifyUser
Messaging.notifyUsersInRoom = function (fromUid, roomId, messageObj) {
Messaging.getUidsInRoom(roomId, 0, -1, function (err, uids) {
async.parallel({
uids: function (next) {
Messaging.getUidsInRoom(roomId, 0, -1, next);
},
roomData: function (next) {
Messaging.getRoomData(roomId, next);
}
}, function (err, results) {
if (err) {
return;
}
@ -23,9 +30,10 @@ module.exports = function (Messaging) {
var data = {
roomId: roomId,
fromUid: fromUid,
message: messageObj
message: messageObj,
roomName: results.roomData.roomName
};
uids.forEach(function (uid) {
results.uids.forEach(function (uid) {
data.self = parseInt(uid, 10) === parseInt(fromUid) ? 1 : 0;
Messaging.pushUnreadCount(uid);
sockets.in('uid_' + uid).emit('event:chats.receive', data);
@ -43,7 +51,7 @@ module.exports = function (Messaging) {
}
queueObj.timeout = setTimeout(function () {
sendNotifications(fromUid, uids, roomId, queueObj.message, function (err) {
sendNotifications(fromUid, results.uids, roomId, queueObj.message, function (err) {
if (!err) {
delete Messaging.notifyQueue[fromUid + ':' + roomId];
}

Loading…
Cancel
Save