summary refs log tree commit diff
path: root/webclient/recents
diff options
context:
space:
mode:
authorMark Haines <mark.haines@matrix.org>2014-11-04 15:57:23 +0000
committerMark Haines <mark.haines@matrix.org>2014-11-04 15:57:23 +0000
commit89ba802b23bf1fd22afbc5e9a4b3b732264e3c18 (patch)
tree34b7803cf8dfb570165c1b1c6f674dc5ca4476c7 /webclient/recents
parentMerge pull request #11 from matrix-org/webclient-room-data-restructure (diff)
downloadsynapse-89ba802b23bf1fd22afbc5e9a4b3b732264e3c18.tar.xz
Move webclient to a python module so that it can be installed
Diffstat (limited to 'webclient/recents')
-rw-r--r--webclient/recents/recents-controller.js34
-rw-r--r--webclient/recents/recents-filter.js71
-rw-r--r--webclient/recents/recents.html110
3 files changed, 0 insertions, 215 deletions
diff --git a/webclient/recents/recents-controller.js b/webclient/recents/recents-controller.js
deleted file mode 100644
index 6f0be18f1a..0000000000
--- a/webclient/recents/recents-controller.js
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- Copyright 2014 OpenMarket Ltd
- 
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
- 
- http://www.apache.org/licenses/LICENSE-2.0
- 
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- */
-
-'use strict';
-
-angular.module('RecentsController', ['matrixService', 'matrixFilter'])
-.controller('RecentsController', ['$rootScope', '$scope', 'eventHandlerService', 'modelService', 
-                               function($rootScope, $scope, eventHandlerService, modelService) {
-
-    // Expose the service to the view
-    $scope.eventHandlerService = eventHandlerService;
-    
-    // retrieve all rooms and expose them
-    $scope.rooms = modelService.getRooms();
-
-    // $rootScope of the parent where the recents component is included can override this value
-    // in order to highlight a specific room in the list
-    $rootScope.recentsSelectedRoomID;
-
-}]);
-
diff --git a/webclient/recents/recents-filter.js b/webclient/recents/recents-filter.js
deleted file mode 100644
index 39c2359967..0000000000
--- a/webclient/recents/recents-filter.js
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- Copyright 2014 OpenMarket Ltd
- 
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
- 
- http://www.apache.org/licenses/LICENSE-2.0
- 
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- */
-
-'use strict';
-
-angular.module('RecentsController')
-.filter('orderRecents', ["matrixService", "eventHandlerService", "modelService", function(matrixService, eventHandlerService, modelService) {
-    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) {
-            room.recent = {};
-            var meEvent = room.current_room_state.state("m.room.member", user_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 = modelService.getMember(room_id, user_id);
-            room.recent.me = member;
-            if (member && ("invite" === member.content.membership || "join" === member.content.membership)) {
-                if ("invite" === member.content.membership) {
-                    room.recent.inviter = member.user_id;
-                }
-                // Count users here
-                // TODO: Compute it directly in eventHandlerService
-                room.recent.numUsersInRoom = eventHandlerService.getUsersCountInRoom(room_id);
-
-                filtered.push(room);
-            }
-            else if (meEvent && "invite" === meEvent.content.membership) {
-                // The only information we have about the room is that the user has been invited
-                filtered.push(room);
-            }
-        });
-
-        // And time sort them
-        // The room with the latest message at first
-        filtered.sort(function (roomA, roomB) {
-
-            var lastMsgRoomA = eventHandlerService.getLastMessage(roomA.room_id, true);
-            var lastMsgRoomB = eventHandlerService.getLastMessage(roomB.room_id, true);
-
-            // Invite message does not have a body message nor ts
-            // Puth them at the top of the list
-            if (undefined === lastMsgRoomA) {
-                return -1;
-            }
-            else if (undefined === lastMsgRoomB) {
-                return 1;
-            }
-            else {
-                return lastMsgRoomB.origin_server_ts - lastMsgRoomA.origin_server_ts;
-            }
-        });
-        return filtered;
-    };
-}]);
diff --git a/webclient/recents/recents.html b/webclient/recents/recents.html
deleted file mode 100644
index 7297e23703..0000000000
--- a/webclient/recents/recents.html
+++ /dev/null
@@ -1,110 +0,0 @@
-<div ng-controller="RecentsController">
-    <table class="recentsTable">
-        <tbody ng-repeat="(index, room) in rooms | orderRecents" 
-               ng-click="goToPage('room/' + (room.room_alias ? room.room_alias : room.room_id) )" 
-               class="recentsRoom" 
-               ng-class="{'recentsRoomSelected': (room.room_id === recentsSelectedRoomID)}">                                           
-            <tr>
-                <td ng-class="room.current_room_state.state('m.room.join_rules').content.join_rule == 'public' ? 'recentsRoomName recentsPublicRoom' : 'recentsRoomName'">
-                    {{ room.room_id | mRoomName }}
-                </td>
-                <td class="recentsRoomSummaryUsersCount">
-                    <span ng-show="undefined !== room.recent.numUsersInRoom">
-                        {{ room.recent.numUsersInRoom || '1' }} {{ room.recent.numUsersInRoom == 1 ? 'user' : 'users' }}                     
-                    </span>
-                </td>
-                <td class="recentsRoomSummaryTS">
-                    <!-- Use a temp var as alias to the last room message.
-                         Declaring it in this way ensures the data-binding -->
-                    {{ lastMsg = eventHandlerService.getLastMessage(room.room_id, true);"" }}
-
-                    {{ (lastMsg.origin_server_ts) | date:'MMM d HH:mm' }}
-                    
-                    <img ng-click="leave(room.room_id); $event.stopPropagation();" src="img/close.png" width="10" height="10" style="margin-bottom: -1px; margin-left: 2px;" alt="close"/>
-                </td>
-            </tr>
-
-            <tr>
-                <td colspan="3" class="recentsRoomSummary">
-
-                    <div ng-show="room.recent.me.content.membership === 'invite'">
-                        {{ room.recent.inviter | mUserDisplayName: room.room_id }} invited you
-                    </div>
-                    
-                    <div ng-hide="room.recent.me.membership === 'invite'" ng-switch="lastMsg.type">
-                        <div ng-switch-when="m.room.member">
-                            <span ng-switch="lastMsg.changedKey">
-                                <span ng-switch-when="membership">
-                                    <span ng-if="'join' === lastMsg.content.membership">
-                                        {{ lastMsg.state_key | mUserDisplayName: room.room_id }} joined
-                                    </span>
-                                    <span ng-if="'leave' === lastMsg.content.membership">
-                                        <span ng-if="lastMsg.user_id === lastMsg.state_key">
-                                            {{lastMsg.state_key | mUserDisplayName: room.room_id }} left
-                                        </span>
-                                        <span ng-if="lastMsg.user_id !== lastMsg.state_key && lastMsg.prev_content">
-                                            {{ lastMsg.user_id | mUserDisplayName: room.room_id }}
-                                            {{ {"invite": "kicked", "join": "kicked", "ban": "unbanned"}[lastMsg.prev_content.membership] }}
-                                            {{ lastMsg.state_key | mUserDisplayName: room.room_id }}
-                                        </span>
-                                        <span ng-if="lastMsg.prev_content && 'join' === lastMsg.prev_content.membership && lastMsg.content.reason">
-                                            : {{ lastMsg.content.reason }}
-                                        </span>
-                                    </span>
-                                    <span ng-if="'invite' === lastMsg.content.membership || 'ban' === lastMsg.content.membership">
-                                        {{ lastMsg.user_id | mUserDisplayName: room.room_id }}
-                                        {{ {"invite": "invited", "ban": "banned"}[lastMsg.content.membership] }}
-                                        {{ lastMsg.state_key | mUserDisplayName: room.room_id }}
-                                        <span ng-if="lastMsg.prev_content && 'ban' === lastMsg.prev_content.membership && lastMsg.content.reason">
-                                            : {{ lastMsg.content.reason }}
-                                        </span>
-                                    </span>         
-                                </span>
-                                <span ng-switch-when="displayname">
-                                    {{ lastMsg.user_id }} changed their display name from {{ lastMsg.prev_content.displayname }} to {{ lastMsg.content.displayname }}
-                                </span>
-                            </span>
-                        </div>
-
-                        <div ng-switch-when="m.room.message">
-                            <div ng-switch="lastMsg.content.msgtype">
-                                <div ng-switch-when="m.text">
-                                    {{ lastMsg.user_id | mUserDisplayName: room.room_id }} :
-                                    <span ng-bind-html="(lastMsg.content.body) | linky:'_blank'">
-                                    </span>
-                                </div>
-
-                                <div ng-switch-when="m.image">
-                                    {{ lastMsg.user_id | mUserDisplayName: room.room_id }} sent an image
-                                </div>
-
-                                <div ng-switch-when="m.emote">
-                                    <span ng-bind-html="'* ' + (lastMsg.user_id | mUserDisplayName: room.room_id) + ' ' + lastMsg.content.body | linky:'_blank'">
-                                    </span>
-                                </div>
-
-                                <div ng-switch-default>
-                                    {{ lastMsg.content }}
-                                </div>
-                            </div>
-                        </div>
-
-                        <div ng-switch-when="m.room.topic">
-                            {{ lastMsg.user_id | mUserDisplayName: room.room_id }} changed the topic to: {{ lastMsg.content.topic }}
-                        </div>
-
-                        <div ng-switch-when="m.room.name">
-                            {{ lastMsg.user_id | mUserDisplayName: room.room_id }} changed the room name to: {{ lastMsg.content.name }}
-                        </div>
-
-                        <div ng-switch-default>
-                            <div ng-if="lastMsg.type.indexOf('m.call.') === 0">
-                                Call
-                            </div>
-                        </div>
-                    </div>
-                </td>
-            </tr>
-        </tbody>
-    </table>
-</div>