diff options
author | Kegan Dougal <kegan@matrix.org> | 2014-11-14 11:29:50 +0000 |
---|---|---|
committer | Kegan Dougal <kegan@matrix.org> | 2014-11-14 11:29:50 +0000 |
commit | 49a1b4262d1efbadb83d0959339d8b208dd9bc93 (patch) | |
tree | 45ecc72f81ca965404d2b075f10f09aa78a0f974 /syweb/webclient/room/room-controller.js | |
parent | Use mUserDisplayName filter in more places. Store power_level[norm] for each ... (diff) | |
download | synapse-49a1b4262d1efbadb83d0959339d8b208dd9bc93.tar.xz |
Use modelService to access room member power levels rather than RoomController.
Diffstat (limited to 'syweb/webclient/room/room-controller.js')
-rw-r--r-- | syweb/webclient/room/room-controller.js | 45 |
1 files changed, 0 insertions, 45 deletions
diff --git a/syweb/webclient/room/room-controller.js b/syweb/webclient/room/room-controller.js index 9a9381ed98..83ed595966 100644 --- a/syweb/webclient/room/room-controller.js +++ b/syweb/webclient/room/room-controller.js @@ -182,14 +182,6 @@ angular.module('RoomController', ['ngSanitize', 'matrixFilter', 'mFileInput', 'a updatePresence(event); } }); - - $scope.$on(eventHandlerService.POWERLEVEL_EVENT, function(ngEvent, event, isLive) { - if (isLive && event.room_id === $scope.room_id) { - for (var user_id in event.content) { - updateUserPowerLevel(user_id); - } - } - }); $scope.memberCount = function() { return Object.keys($scope.members).length; @@ -359,40 +351,6 @@ angular.module('RoomController', ['ngSanitize', 'matrixFilter', 'mFileInput', 'a } }; - var updateUserPowerLevel = function(user_id) { - var member = $scope.members[user_id]; - if (member) { - member.powerLevel = eventHandlerService.getUserPowerLevel($scope.room_id, user_id); - - normaliseMembersPowerLevels(); - } - }; - - // Normalise users power levels so that the user with the higher power level - // will have a bar covering 100% of the width of his avatar - var normaliseMembersPowerLevels = function() { - // Find the max power level - var maxPowerLevel = 0; - for (var i in $scope.members) { - if (!$scope.members.hasOwnProperty(i)) continue; - - var member = $scope.members[i]; - if (member.powerLevel) { - maxPowerLevel = Math.max(maxPowerLevel, member.powerLevel); - } - } - - // Normalized them on a 0..100% scale to be use in css width - if (maxPowerLevel) { - for (var i in $scope.members) { - if (!$scope.members.hasOwnProperty(i)) continue; - - var member = $scope.members[i]; - member.powerLevelNorm = (member.powerLevel * 100) / maxPowerLevel; - } - } - }; - $scope.send = function() { var input = $('#mainInput').val(); @@ -621,9 +579,6 @@ angular.module('RoomController', ['ngSanitize', 'matrixFilter', 'mFileInput', 'a for (var i = 0; i < response.data.chunk.length; i++) { var chunk = response.data.chunk[i]; updateMemberList(chunk); - - // Add his power level - updateUserPowerLevel(chunk.user_id); } // Arm list timing update timer |