Fix a few cases where we used user_id instead of state_key

paul/schema_breaking_changes^2
Erik Johnston 2014-09-03 18:02:51 +01:00
parent 5391ccdfe6
commit 0d75b9fa96
2 changed files with 6 additions and 6 deletions

View File

@ -107,18 +107,18 @@ angular.module('matrixWebClient')
if (2 === Object.keys(room.members).length) { if (2 === Object.keys(room.members).length) {
for (var i in room.members) { for (var i in room.members) {
var member = room.members[i]; var member = room.members[i];
if (member.user_id !== matrixService.config().user_id) { if (member.state_key !== matrixService.config().user_id) {
if (member.user_id in $rootScope.presence) { if (member.state_key in $rootScope.presence) {
// If the user is available in presence, use the displayname there // If the user is available in presence, use the displayname there
// as it is the most uptodate // as it is the most uptodate
roomName = $rootScope.presence[member.user_id].content.displayname; roomName = $rootScope.presence[member.state_key].content.displayname;
} }
else if (member.content.displayname) { else if (member.content.displayname) {
roomName = member.content.displayname; roomName = member.content.displayname;
} }
else { else {
roomName = member.user_id; roomName = member.state_key;
} }
} }
} }
@ -145,7 +145,7 @@ angular.module('matrixWebClient')
roomName = $rootScope.presence[userID].content.displayname; roomName = $rootScope.presence[userID].content.displayname;
} }
else { else {
roomName = member.user_id; roomName = userID;
} }
} }
} }

View File

@ -97,7 +97,7 @@ angular.module('eventHandlerService', [])
} }
} }
$rootScope.events.rooms[event.room_id].members[event.user_id] = event; $rootScope.events.rooms[event.room_id].members[event.state_key] = event;
$rootScope.$broadcast(MEMBER_EVENT, event, isLiveEvent); $rootScope.$broadcast(MEMBER_EVENT, event, isLiveEvent);
}; };