summary refs log tree commit diff
path: root/webclient/room/room-controller.js
diff options
context:
space:
mode:
Diffstat (limited to 'webclient/room/room-controller.js')
-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 {