summary refs log tree commit diff
path: root/webclient/room/room-controller.js
diff options
context:
space:
mode:
authorEmmanuel ROHEE <erohee@amdocs.com>2014-09-03 14:12:56 +0200
committerEmmanuel ROHEE <erohee@amdocs.com>2014-09-03 14:12:56 +0200
commit4b85c5f52ca5a87fa998d70db81d9f158aa90ada (patch)
tree6e7185b8468d36eb31694701e0f3fbab111684ab /webclient/room/room-controller.js
parentUpdated feedback api docs and fixed feedback content template bug (diff)
downloadsynapse-4b85c5f52ca5a87fa998d70db81d9f158aa90ada.tar.xz
Added /op $user_id $powerLevel
Diffstat (limited to '')
-rw-r--r--webclient/room/room-controller.js18
1 files changed, 17 insertions, 1 deletions
diff --git a/webclient/room/room-controller.js b/webclient/room/room-controller.js
index 13bddc5451..d96241b863 100644
--- a/webclient/room/room-controller.js
+++ b/webclient/room/room-controller.js
@@ -85,6 +85,14 @@ angular.module('RoomController', ['ngSanitize', 'mFileInput'])
             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;
@@ -278,7 +286,6 @@ angular.module('RoomController', ['ngSanitize', 'mFileInput'])
                 case "/ban":
                     // Ban the user id from the room
                     if (2 <= args.length) {
-
                         // TODO: The user may have entered the display name
                         // Need display name -> user_id resolution. Pb: how to manage user with same display names?
                         var user_id = args[1];
@@ -290,6 +297,15 @@ angular.module('RoomController', ['ngSanitize', 'mFileInput'])
                         promise = matrixService.ban($scope.room_id, user_id, reason);
                     }
                     break;
+                    
+                case "/op":
+                    if (3 === args.length) {
+                        var user_id = args[1];
+                        var powerLevel = parseInt(args[2]);
+
+                        promise = matrixService.setUserPowerLevel($scope.room_id, user_id, powerLevel);
+                    }
+                    break;
             }
         }
         else {