Keep track of people's presence and query that when we update the members list.
This commit is contained in:
parent
74c90f7815
commit
6118a102c1
|
@ -36,6 +36,8 @@ angular.module('eventHandlerService', [])
|
||||||
rooms: {}, // will contain roomId: { messages:[], members:{userid1: event} }
|
rooms: {}, // will contain roomId: { messages:[], members:{userid1: event} }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
$rootScope.presence = {};
|
||||||
|
|
||||||
var initRoom = function(room_id) {
|
var initRoom = function(room_id) {
|
||||||
if (!(room_id in $rootScope.events.rooms)) {
|
if (!(room_id in $rootScope.events.rooms)) {
|
||||||
console.log("Creating new handler entry for " + room_id);
|
console.log("Creating new handler entry for " + room_id);
|
||||||
|
@ -91,6 +93,7 @@ angular.module('eventHandlerService', [])
|
||||||
};
|
};
|
||||||
|
|
||||||
var handlePresence = function(event, isLiveEvent) {
|
var handlePresence = function(event, isLiveEvent) {
|
||||||
|
$rootScope.presence[event.content.user_id] = event;
|
||||||
$rootScope.$broadcast(PRESENCE_EVENT, event, isLiveEvent);
|
$rootScope.$broadcast(PRESENCE_EVENT, event, isLiveEvent);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -15,8 +15,8 @@ limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
angular.module('RoomController', ['ngSanitize', 'mUtilities'])
|
angular.module('RoomController', ['ngSanitize', 'mUtilities'])
|
||||||
.controller('RoomController', ['$scope', '$http', '$timeout', '$routeParams', '$location', 'matrixService', 'eventStreamService', 'eventHandlerService', 'mFileUpload', 'mUtilities',
|
.controller('RoomController', ['$scope', '$http', '$timeout', '$routeParams', '$location', 'matrixService', 'eventStreamService', 'eventHandlerService', 'mFileUpload', 'mUtilities', '$rootScope',
|
||||||
function($scope, $http, $timeout, $routeParams, $location, matrixService, eventStreamService, eventHandlerService, mFileUpload, mUtilities) {
|
function($scope, $http, $timeout, $routeParams, $location, matrixService, eventStreamService, eventHandlerService, mFileUpload, mUtilities, $rootScope) {
|
||||||
'use strict';
|
'use strict';
|
||||||
var MESSAGES_PER_PAGINATION = 30;
|
var MESSAGES_PER_PAGINATION = 30;
|
||||||
var THUMBNAIL_SIZE = 320;
|
var THUMBNAIL_SIZE = 320;
|
||||||
|
@ -199,6 +199,10 @@ angular.module('RoomController', ['ngSanitize', 'mUtilities'])
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
if (chunk.target_user_id in $rootScope.presence) {
|
||||||
|
updatePresence($rootScope.presence[chunk.target_user_id]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// selectively update membership else it will nuke the picture and displayname too :/
|
// selectively update membership else it will nuke the picture and displayname too :/
|
||||||
|
|
Loading…
Reference in New Issue