summary refs log tree commit diff
path: root/syweb
diff options
context:
space:
mode:
authorKegan Dougal <kegan@matrix.org>2014-11-12 11:24:05 +0000
committerKegan Dougal <kegan@matrix.org>2014-11-12 11:24:05 +0000
commit2c400363e8f4c7d726aee06119fb4c4f18edfddd (patch)
tree1b5b73bff942fcb260dbf54db61dcde7149891e7 /syweb
parentMove room alias/id mapping logic from matrixService to modelService. (diff)
downloadsynapse-2c400363e8f4c7d726aee06119fb4c4f18edfddd.tar.xz
SYWEB-146: Fix room ID leaking on recents page when the name of the room is just an alias.
Diffstat (limited to 'syweb')
-rw-r--r--syweb/webclient/components/matrix/matrix-service.js1
-rw-r--r--syweb/webclient/components/matrix/model-service.js10
2 files changed, 8 insertions, 3 deletions
diff --git a/syweb/webclient/components/matrix/matrix-service.js b/syweb/webclient/components/matrix/matrix-service.js
index 70747155f9..c1264887c8 100644
--- a/syweb/webclient/components/matrix/matrix-service.js
+++ b/syweb/webclient/components/matrix/matrix-service.js
@@ -39,7 +39,6 @@ angular.module('matrixService', [])
     // Current version of permanent storage
     var configVersion = 0;
     var prefixPath = "/_matrix/client/api/v1";
-    var MAPPING_PREFIX = "alias_for_";
 
     var doRequest = function(method, path, params, data, $httpParams) {
         if (!config) {
diff --git a/syweb/webclient/components/matrix/model-service.js b/syweb/webclient/components/matrix/model-service.js
index c6f0defb61..578804c994 100644
--- a/syweb/webclient/components/matrix/model-service.js
+++ b/syweb/webclient/components/matrix/model-service.js
@@ -31,6 +31,10 @@ angular.module('modelService', [])
     // alias / id lookups
     var roomIdToAlias = {};
     var aliasToRoomId = {};
+    var setRoomIdToAliasMapping = function(roomId, alias) {
+        roomIdToAlias[roomId] = alias;
+        aliasToRoomId[alias] = roomId;
+    };
     
     /***** Room Object *****/
     var Room = function Room(room_id) {
@@ -114,6 +118,9 @@ angular.module('modelService', [])
                 rm.event = event;
                 this.members[event.state_key] = rm;
             }
+            else if (event.type === "m.room.aliases") {
+                setRoomIdToAliasMapping(event.room_id, event.content.aliases[0]);
+            }
         },
         
         storeStateEvents: function storeState(events) {
@@ -210,8 +217,7 @@ angular.module('modelService', [])
         },
         
         createRoomIdToAliasMapping: function(roomId, alias) {
-            roomIdToAlias[roomId] = alias;
-            aliasToRoomId[alias] = roomId;
+            setRoomIdToAliasMapping(roomId, alias);
         },
         
         getRoomIdToAliasMapping: function(roomId) {