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-11 16:54:51 +0200
committerEmmanuel ROHEE <erohee@amdocs.com>2014-09-11 16:54:57 +0200
commitceec607e7fdfd4e1fb27b072f390476721409a82 (patch)
tree9e17fdfac1abc1c3604f6315e606edff70e64b07 /webclient/room/room-controller.js
parentstart towards glare support (currently not much better but no worse than befo... (diff)
downloadsynapse-ceec607e7fdfd4e1fb27b072f390476721409a82.tar.xz
Clearly show when an user cannot join a room.
In realtime show who kicked or banned him.
Diffstat (limited to 'webclient/room/room-controller.js')
-rw-r--r--webclient/room/room-controller.js25
1 files changed, 24 insertions, 1 deletions
diff --git a/webclient/room/room-controller.js b/webclient/room/room-controller.js
index da77864017..9f15b61e10 100644
--- a/webclient/room/room-controller.js
+++ b/webclient/room/room-controller.js
@@ -27,6 +27,7 @@ angular.module('RoomController', ['ngSanitize', 'matrixFilter', 'mFileInput'])
 
     $scope.state = {
         user_id: matrixService.config().user_id,
+        permission_denied: undefined, // If defined, this string contains the reason why the user cannot join the room
         first_pagination: true, // this is toggled off when the first pagination is done
         can_paginate: false, // this is toggled off when we are not ready yet to paginate or when we run out of items
         paginating: false, // used to avoid concurrent pagination requests pulling in dup contents
@@ -129,6 +130,28 @@ angular.module('RoomController', ['ngSanitize', 'matrixFilter', 'mFileInput'])
                 $scope.state.waiting_for_joined_event = false;
                 onInit3();
             }
+            else if (event.state_key === $scope.state.user_id && "invite" !== event.membership && "join" !== event.membership) {
+                var user;
+                        
+                if ($scope.members[event.user_id]) {
+                    user = $scope.members[event.user_id].displayname;
+                }
+                if (user) {
+                    user = user + " (" + event.user_id + ")";
+                }
+                else {
+                    user = event.user_id;
+                }
+
+                 
+                if ("ban" === event.membership) {
+                    $scope.state.permission_denied = "You have been banned by " + user;
+                }
+                else {
+                    $scope.state.permission_denied = "You have been kicked by " + user;
+                }
+                
+            }
             else {
                 scrollToBottom();
                 updateMemberList(event); 
@@ -654,7 +677,7 @@ angular.module('RoomController', ['ngSanitize', 'matrixFilter', 'mFileInput'])
                         },
                         function(reason) {
                             console.log("Can't join room: " + JSON.stringify(reason));
-                            $scope.feedback = "You do not have permission to join this room";
+                            $scope.state.permission_denied = "You do not have permission to join this room";
                         });
                 }
                 else {