summary refs log tree commit diff
path: root/webclient/recents
diff options
context:
space:
mode:
authorEmmanuel ROHEE <erohee@amdocs.com>2014-09-15 18:22:38 +0200
committerEmmanuel ROHEE <erohee@amdocs.com>2014-09-15 18:22:38 +0200
commitb0483cd47d72ea73760c8301f5729d840ceb7683 (patch)
treea52e834e416ae3691f5821109afebfdf16fdd519 /webclient/recents
parentRecents must not show temporary fake messages (diff)
downloadsynapse-b0483cd47d72ea73760c8301f5729d840ceb7683.tar.xz
Filter room where the user has been banned
Diffstat (limited to 'webclient/recents')
-rw-r--r--webclient/recents/recents-filter.js18
1 files changed, 13 insertions, 5 deletions
diff --git a/webclient/recents/recents-filter.js b/webclient/recents/recents-filter.js
index 67fe49d4b6..2fd4dbe98b 100644
--- a/webclient/recents/recents-filter.js
+++ b/webclient/recents/recents-filter.js
@@ -17,19 +17,27 @@
 'use strict';
 
 angular.module('RecentsController')
-.filter('orderRecents', ["eventHandlerService", function(eventHandlerService) {
+.filter('orderRecents', ["matrixService", "eventHandlerService", function(matrixService, eventHandlerService) {
     return function(rooms) {
 
+        var user_id = matrixService.config().user_id;
+
         // Transform the dict into an array
         // The key, room_id, is already in value objects
         var filtered = [];
         angular.forEach(rooms, function(room, room_id) {
 
-            // Count users here
-            // TODO: Compute it directly in eventHandlerService
-            room.numUsersInRoom = eventHandlerService.getUsersCountInRoom(room_id);
+            // Show the room only if the user has joined it or has been invited
+            // (ie, do not show it if he has been banned)
+            var member = eventHandlerService.getMember(room_id, user_id);
+            if (member && ("invite" === member.membership || "join" === member.membership)) {
+            
+                // Count users here
+                // TODO: Compute it directly in eventHandlerService
+                room.numUsersInRoom = eventHandlerService.getUsersCountInRoom(room_id);
 
-            filtered.push(room);
+                filtered.push(room);
+            }
         });
 
         // And time sort them