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-05 17:30:50 +0200
committerEmmanuel ROHEE <erohee@amdocs.com>2014-09-05 17:30:50 +0200
commit3be615677407a4224202a3ae107762b1f3bc97ac (patch)
tree8f175e43edbee68065535b44862f3eb6b5abb05e /webclient/room/room-controller.js
parentAdded sanity checks in commands (diff)
downloadsynapse-3be615677407a4224202a3ae107762b1f3bc97ac.tar.xz
Created kick & unban methods in matrixService. Made some factorisation.
Diffstat (limited to 'webclient/room/room-controller.js')
-rw-r--r--webclient/room/room-controller.js15
1 files changed, 3 insertions, 12 deletions
diff --git a/webclient/room/room-controller.js b/webclient/room/room-controller.js
index 39f8635d76..905a0723d8 100644
--- a/webclient/room/room-controller.js
+++ b/webclient/room/room-controller.js
@@ -325,15 +325,9 @@ angular.module('RoomController', ['ngSanitize', 'matrixFilter', 'mFileInput'])
                     // Kick a user from the room with an optional reason
                     if (args) {
                         var matches = args.match(/^(\S+?)( +(.*))?$/);
-                        if (matches.length === 2) {
-                            promise = matrixService.setMembership($scope.room_id, matches[1], "leave");                        
+                        if (matches) {
+                            promise = matrixService.kick($scope.room_id, matches[1], matches[3]);
                         }
-                        else if (matches.length === 4) {
-                            promise = matrixService.setMembershipObject($scope.room_id, matches[1], {
-                                membership: "leave",
-                                reason: matches[3] // TODO: we need to specify resaon in the spec
-                            });
-                        }        
                     }
 
                     if (!promise) {
@@ -357,14 +351,11 @@ angular.module('RoomController', ['ngSanitize', 'matrixFilter', 'mFileInput'])
 
                 case "/unban":
                     // Unban a user from the room
-                    // FIXME: this feels horribly asymmetrical - why are we banning via RPC
-                    // and unbanning by editing the membership list?
-                    // Why can't we specify a reason?
                     if (args) {
                         var matches = args.match(/^(\S+)$/);
                         if (matches) {
                             // Reset the user membership to "leave" to unban him
-                            promise = matrixService.setMembership($scope.room_id, matches[1], "leave");
+                            promise = matrixService.unban($scope.room_id, matches[1]);
                         }
                     }