From 89ba802b23bf1fd22afbc5e9a4b3b732264e3c18 Mon Sep 17 00:00:00 2001 From: Mark Haines Date: Tue, 4 Nov 2014 15:57:23 +0000 Subject: Move webclient to a python module so that it can be installed --- syweb/webclient/recents/recents.html | 110 +++++++++++++++++++++++++++++++++++ 1 file changed, 110 insertions(+) create mode 100644 syweb/webclient/recents/recents.html (limited to 'syweb/webclient/recents/recents.html') diff --git a/syweb/webclient/recents/recents.html b/syweb/webclient/recents/recents.html new file mode 100644 index 0000000000..7297e23703 --- /dev/null +++ b/syweb/webclient/recents/recents.html @@ -0,0 +1,110 @@ +
+ + + + + + + + + + + + +
+ {{ room.room_id | mRoomName }} + + + {{ room.recent.numUsersInRoom || '1' }} {{ room.recent.numUsersInRoom == 1 ? 'user' : 'users' }} + + + + {{ lastMsg = eventHandlerService.getLastMessage(room.room_id, true);"" }} + + {{ (lastMsg.origin_server_ts) | date:'MMM d HH:mm' }} + + close +
+ +
+ {{ room.recent.inviter | mUserDisplayName: room.room_id }} invited you +
+ +
+
+ + + + {{ lastMsg.state_key | mUserDisplayName: room.room_id }} joined + + + + {{lastMsg.state_key | mUserDisplayName: room.room_id }} left + + + {{ lastMsg.user_id | mUserDisplayName: room.room_id }} + {{ {"invite": "kicked", "join": "kicked", "ban": "unbanned"}[lastMsg.prev_content.membership] }} + {{ lastMsg.state_key | mUserDisplayName: room.room_id }} + + + : {{ lastMsg.content.reason }} + + + + {{ lastMsg.user_id | mUserDisplayName: room.room_id }} + {{ {"invite": "invited", "ban": "banned"}[lastMsg.content.membership] }} + {{ lastMsg.state_key | mUserDisplayName: room.room_id }} + + : {{ lastMsg.content.reason }} + + + + + {{ lastMsg.user_id }} changed their display name from {{ lastMsg.prev_content.displayname }} to {{ lastMsg.content.displayname }} + + +
+ +
+
+
+ {{ lastMsg.user_id | mUserDisplayName: room.room_id }} : + + +
+ +
+ {{ lastMsg.user_id | mUserDisplayName: room.room_id }} sent an image +
+ +
+ + +
+ +
+ {{ lastMsg.content }} +
+
+
+ +
+ {{ lastMsg.user_id | mUserDisplayName: room.room_id }} changed the topic to: {{ lastMsg.content.topic }} +
+ +
+ {{ lastMsg.user_id | mUserDisplayName: room.room_id }} changed the room name to: {{ lastMsg.content.name }} +
+ +
+
+ Call +
+
+
+
+
-- cgit 1.5.1 From e632fcd933b7259853ba0522e052e73fd4f4e71a Mon Sep 17 00:00:00 2001 From: Kegan Dougal Date: Wed, 12 Nov 2014 14:31:30 +0000 Subject: SYWEB-57: Highlight rooms where the history has changed. This highlights rooms when something has happened and you haven't viewed it yet. It highlights entries in a slightly red background colour. --- syweb/webclient/app.css | 4 ++++ syweb/webclient/recents/recents-controller.js | 28 ++++++++++++++++++++++++--- syweb/webclient/recents/recents.html | 6 +++--- syweb/webclient/room/room-controller.js | 2 +- 4 files changed, 33 insertions(+), 7 deletions(-) (limited to 'syweb/webclient/recents/recents.html') diff --git a/syweb/webclient/app.css b/syweb/webclient/app.css index 403d615bf1..7a4ff0467b 100755 --- a/syweb/webclient/app.css +++ b/syweb/webclient/app.css @@ -812,6 +812,10 @@ textarea, input { background-color: #eee; } +.recentsRoomUnread { + background-color: #fee; +} + .recentsRoomName { font-size: 16px; padding-top: 7px; diff --git a/syweb/webclient/recents/recents-controller.js b/syweb/webclient/recents/recents-controller.js index 6f0be18f1a..062d106018 100644 --- a/syweb/webclient/recents/recents-controller.js +++ b/syweb/webclient/recents/recents-controller.js @@ -25,10 +25,32 @@ angular.module('RecentsController', ['matrixService', 'matrixFilter']) // retrieve all rooms and expose them $scope.rooms = modelService.getRooms(); + + if (!$rootScope.unreadMessages) { + $rootScope.unreadMessages = { + // room_id: + }; + } - // $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; + // $rootScope.recentsSelectedRoomID is used in the html, and is set by room-controller. + + + $scope.selectRoom = function(room) { + if ($rootScope.unreadMessages[room.room_id]) { + $rootScope.unreadMessages[room.room_id] = 0; + } + $rootScope.goToPage('room/' + (room.room_alias ? room.room_alias : room.room_id) ); + }; + + $scope.$on(eventHandlerService.MSG_EVENT, function(ngEvent, event, isLive) { + if (isLive && event.room_id !== $rootScope.recentsSelectedRoomID) { + if (!$rootScope.unreadMessages[event.room_id]) { + $rootScope.unreadMessages[event.room_id] = 0; + } + $rootScope.unreadMessages[event.room_id] += 1; + console.log("sel="+$rootScope.recentsSelectedRoomID+" unread:"+JSON.stringify($rootScope.unreadMessages, undefined, 2)); + } + }); }]); diff --git a/syweb/webclient/recents/recents.html b/syweb/webclient/recents/recents.html index 7297e23703..386edb1417 100644 --- a/syweb/webclient/recents/recents.html +++ b/syweb/webclient/recents/recents.html @@ -1,9 +1,9 @@
+ ng-click="selectRoom(room)" + class="recentsRoom" + ng-class="{'recentsRoomSelected': (room.room_id === recentsSelectedRoomID), 'recentsRoomUnread': (unreadMessages[room.room_id])}"> + ng-class="{'recentsRoomSelected': (room.room_id === recentsSelectedRoomID), 'recentsRoomBing': (unreadBings[room.room_id]), 'recentsRoomUnread': (unreadMessages[room.room_id])}">
{{ room.room_id | mRoomName }} diff --git a/syweb/webclient/room/room-controller.js b/syweb/webclient/room/room-controller.js index 6928754c5d..cf6ec08932 100644 --- a/syweb/webclient/room/room-controller.js +++ b/syweb/webclient/room/room-controller.js @@ -804,7 +804,7 @@ angular.module('RoomController', ['ngSanitize', 'matrixFilter', 'mFileInput', 'a console.log("onInit3"); // Make recents highlight the current room - $scope.recentsSelectedRoomID = $scope.room_id; + $rootScope.recentsSelectedRoomID = $scope.room_id; // Init the history for this room history.init(); -- cgit 1.5.1 From 960b28c90a6ca8b9c61a3b376b4f9223203f4f06 Mon Sep 17 00:00:00 2001 From: Kegan Dougal Date: Wed, 12 Nov 2014 15:31:06 +0000 Subject: SYWEB-57: Highlight rooms which have had their bingers go off in blue. Priority is the same as xchat so selected > blue > red. --- syweb/webclient/app.css | 4 ++++ .../components/matrix/event-handler-service.js | 24 ++++++++++++++++------ .../webclient/components/matrix/recents-service.js | 21 +++++++++++++++++++ syweb/webclient/recents/recents-controller.js | 6 ++++++ syweb/webclient/recents/recents.html | 2 +- 5 files changed, 50 insertions(+), 7 deletions(-) (limited to 'syweb/webclient/recents/recents.html') diff --git a/syweb/webclient/app.css b/syweb/webclient/app.css index 7a4ff0467b..648388cdb9 100755 --- a/syweb/webclient/app.css +++ b/syweb/webclient/app.css @@ -816,6 +816,10 @@ textarea, input { background-color: #fee; } +.recentsRoomBing { + background-color: #eef; +} + .recentsRoomName { font-size: 16px; padding-top: 7px; diff --git a/syweb/webclient/components/matrix/event-handler-service.js b/syweb/webclient/components/matrix/event-handler-service.js index 7b2a75507d..6645d20374 100644 --- a/syweb/webclient/components/matrix/event-handler-service.js +++ b/syweb/webclient/components/matrix/event-handler-service.js @@ -95,14 +95,22 @@ function(matrixService, $rootScope, $q, $timeout, $filter, mPresence, notificati modelService.createRoomIdToAliasMapping(event.room_id, event.content.aliases[0]); }; + var containsBingWord = function(event) { + if (!event.content || !event.content.body) { + return false; + } + + return notificationService.containsBingWord( + matrixService.config().user_id, + matrixService.config().display_name, + matrixService.config().bingWords, + event.content.body + ); + }; + var displayNotification = function(event) { if (window.Notification && event.user_id != matrixService.config().user_id) { - var shouldBing = notificationService.containsBingWord( - matrixService.config().user_id, - matrixService.config().display_name, - matrixService.config().bingWords, - event.content.body - ); + var shouldBing = containsBingWord(event); // Ideally we would notify only when the window is hidden (i.e. document.hidden = true). // @@ -529,6 +537,10 @@ function(matrixService, $rootScope, $q, $timeout, $filter, mPresence, notificati resetRoomMessages(room_id); }, + eventContainsBingWord: function(event) { + return containsBingWord(event); + }, + /** * Return the last message event of a room * @param {String} room_id the room id diff --git a/syweb/webclient/components/matrix/recents-service.js b/syweb/webclient/components/matrix/recents-service.js index 237f1e3912..3d82b8218b 100644 --- a/syweb/webclient/components/matrix/recents-service.js +++ b/syweb/webclient/components/matrix/recents-service.js @@ -38,9 +38,22 @@ angular.module('recentsService', []) // room_id: }; + var BROADCAST_UNREAD_BING_MESSAGES = "recentsService:BROADCAST_UNREAD_BING_MESSAGES(room_id, event)"; + var unreadBingMessages = { + // room_id: bingEvent + }; + // listen for new unread messages $rootScope.$on(eventHandlerService.MSG_EVENT, function(ngEvent, event, isLive) { if (isLive && event.room_id !== selectedRoomId) { + if (eventHandlerService.eventContainsBingWord(event)) { + if (!unreadBingMessages[event.room_id]) { + unreadBingMessages[event.room_id] = {}; + } + unreadBingMessages[event.room_id] = event; + $rootScope.$broadcast(BROADCAST_UNREAD_BING_MESSAGES, event.room_id, event); + } + if (!unreadMessages[event.room_id]) { unreadMessages[event.room_id] = 0; } @@ -66,11 +79,19 @@ angular.module('recentsService', []) return unreadMessages; }, + getUnreadBingMessages: function() { + return unreadBingMessages; + }, + markAsRead: function(room_id) { if (unreadMessages[room_id]) { unreadMessages[room_id] = 0; } + if (unreadBingMessages[room_id]) { + unreadBingMessages[room_id] = undefined; + } $rootScope.$broadcast(BROADCAST_UNREAD_MESSAGES, room_id, 0); + $rootScope.$broadcast(BROADCAST_UNREAD_BING_MESSAGES, room_id, undefined); } }; diff --git a/syweb/webclient/recents/recents-controller.js b/syweb/webclient/recents/recents-controller.js index 5c2cf270c3..41720d4cb0 100644 --- a/syweb/webclient/recents/recents-controller.js +++ b/syweb/webclient/recents/recents-controller.js @@ -38,6 +38,12 @@ angular.module('RecentsController', ['matrixService', 'matrixFilter']) $scope.unreadMessages = recentsService.getUnreadMessages(); }); + // track the list of unread BING messages: the html will use this + $scope.unreadBings = recentsService.getUnreadBingMessages(); + $scope.$on(recentsService.BROADCAST_UNREAD_BING_MESSAGES, function(ngEvent, room_id, event) { + $scope.unreadBings = recentsService.getUnreadBingMessages(); + }); + $scope.selectRoom = function(room) { recentsService.markAsRead(room.room_id); $rootScope.goToPage('room/' + (room.room_alias ? room.room_alias : room.room_id) ); diff --git a/syweb/webclient/recents/recents.html b/syweb/webclient/recents/recents.html index 386edb1417..0b3a77ca11 100644 --- a/syweb/webclient/recents/recents.html +++ b/syweb/webclient/recents/recents.html @@ -3,7 +3,7 @@
{{ room.room_id | mRoomName }} -- cgit 1.5.1