From 547adda446c3ddf66c6666f681a279582d5f5320 Mon Sep 17 00:00:00 2001 From: Kegan Dougal Date: Mon, 17 Nov 2014 10:04:36 +0000 Subject: Move getLastMessage to modelService. --- syweb/webclient/recents/recents-controller.js | 6 +++--- syweb/webclient/recents/recents-filter.js | 8 ++++---- syweb/webclient/recents/recents.html | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) (limited to 'syweb/webclient/recents') diff --git a/syweb/webclient/recents/recents-controller.js b/syweb/webclient/recents/recents-controller.js index 41720d4cb0..6b2915d03b 100644 --- a/syweb/webclient/recents/recents-controller.js +++ b/syweb/webclient/recents/recents-controller.js @@ -17,11 +17,11 @@ 'use strict'; angular.module('RecentsController', ['matrixService', 'matrixFilter']) -.controller('RecentsController', ['$rootScope', '$scope', 'eventHandlerService', 'modelService', 'recentsService', - function($rootScope, $scope, eventHandlerService, modelService, recentsService) { +.controller('RecentsController', ['$rootScope', '$scope', 'modelService', 'recentsService', + function($rootScope, $scope, modelService, recentsService) { // Expose the service to the view - $scope.eventHandlerService = eventHandlerService; + $scope.modelService = modelService; // retrieve all rooms and expose them $scope.rooms = modelService.getRooms(); diff --git a/syweb/webclient/recents/recents-filter.js b/syweb/webclient/recents/recents-filter.js index 00304f84dc..31859b1c7f 100644 --- a/syweb/webclient/recents/recents-filter.js +++ b/syweb/webclient/recents/recents-filter.js @@ -17,7 +17,7 @@ 'use strict'; angular.module('RecentsController') -.filter('orderRecents', ["matrixService", "eventHandlerService", "modelService", function(matrixService, eventHandlerService, modelService) { +.filter('orderRecents', ["matrixService", "modelService", function(matrixService, modelService) { return function(rooms) { var user_id = matrixService.config().user_id; @@ -39,7 +39,7 @@ angular.module('RecentsController') room.recent.inviter = member.user_id; } // Count users here - // TODO: Compute it directly in eventHandlerService + // TODO: Compute it directly in modelService room.recent.numUsersInRoom = modelService.getUserCountInRoom(room_id); filtered.push(room); @@ -54,8 +54,8 @@ angular.module('RecentsController') // 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); + var lastMsgRoomA = modelService.getLastMessage(roomA.room_id, true); + var lastMsgRoomB = modelService.getLastMessage(roomB.room_id, true); // Invite message does not have a body message nor ts // Puth them at the top of the list diff --git a/syweb/webclient/recents/recents.html b/syweb/webclient/recents/recents.html index 600e1f9c1a..2596b094f7 100644 --- a/syweb/webclient/recents/recents.html +++ b/syweb/webclient/recents/recents.html @@ -16,7 +16,7 @@ - {{ lastMsg = eventHandlerService.getLastMessage(room.room_id, true);"" }} + {{ lastMsg = modelService.getLastMessage(room.room_id, true);"" }} {{ (lastMsg.origin_server_ts) | date:'MMM d HH:mm' }} -- cgit 1.4.1