diff --git a/public/src/modules/chat.js b/public/src/modules/chat.js
index f231fd765d..9ef9d21c77 100644
--- a/public/src/modules/chat.js
+++ b/public/src/modules/chat.js
@@ -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($('
').html(data.newName).text());
+ var newTitle = $('').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 () {
diff --git a/public/src/modules/taskbar.js b/public/src/modules/taskbar.js
index 7a0b3c39ea..6cd735f15f 100644
--- a/public/src/modules/taskbar.js
+++ b/public/src/modules/taskbar.js
@@ -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('' +
(data.options.icon ? ' ' : '') +
(data.options.image ? '
' : '') +
- '' + title + '' +
+ '' + title + '' +
'')
.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;
});
diff --git a/src/messaging/notifications.js b/src/messaging/notifications.js
index 6d9500c4ba..2737725462 100644
--- a/src/messaging/notifications.js
+++ b/src/messaging/notifications.js
@@ -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];
}