diff options
Diffstat (limited to 'webclient/recents')
-rw-r--r-- | webclient/recents/recents-filter.js | 18 |
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 |