summary refs log tree commit diff
path: root/webclient
diff options
context:
space:
mode:
authorKegan Dougal <kegan@matrix.org>2014-10-27 17:05:05 +0000
committerKegan Dougal <kegan@matrix.org>2014-10-27 17:05:13 +0000
commit4f6acf114cf4ac3f90266ab33f12d599e0f2eb5d (patch)
tree881a1e38f82d057a6d7e35d1b12a140caf50401e /webclient
parentRemove duplicate join_event from create_room (diff)
downloadsynapse-4f6acf114cf4ac3f90266ab33f12d599e0f2eb5d.tar.xz
Fix SYWEB-110 : Prevent room ID leaking by looking for an m.room.name
Diffstat (limited to '')
-rw-r--r--webclient/components/matrix/event-handler-service.js12
1 files changed, 11 insertions, 1 deletions
diff --git a/webclient/components/matrix/event-handler-service.js b/webclient/components/matrix/event-handler-service.js
index e7109c0cb4..b1580b3d8a 100644
--- a/webclient/components/matrix/event-handler-service.js
+++ b/webclient/components/matrix/event-handler-service.js
@@ -221,9 +221,19 @@ function(matrixService, $rootScope, $q, $timeout, mPresence) {
                         message = "* " + displayname + " " + message;
                     }
 
+                    var roomTitle = matrixService.getRoomIdToAliasMapping(event.room_id);
+                    var theRoom = $rootScope.events.rooms[event.room_id];
+                    if (!roomTitle && theRoom && theRoom["m.room.name"] && theRoom["m.room.name"].content) {
+                        roomTitle = theRoom["m.room.name"].content.name;
+                    }
+
+                    if (!roomTitle) {
+                        roomTitle = event.room_id;
+                    }
+                    
                     var notification = new window.Notification(
                         displayname +
-                        " (" + (matrixService.getRoomIdToAliasMapping(event.room_id) || event.room_id) + ")", // FIXME: don't leak room_ids here
+                        " (" + roomTitle + ")",
                     {
                         "body": message,
                         "icon": member ? member.avatar_url : undefined