0
0
Fork 1
mirror of https://mau.dev/maunium/synapse.git synced 2024-11-17 15:31:19 +01:00

BF: Reset base timer time ($scope.now) everytime last_active_ago is touched

This commit is contained in:
Emmanuel ROHEE 2014-09-02 16:39:17 +02:00
parent b4984d5e15
commit bcf30b29ad

View file

@ -164,8 +164,6 @@ angular.module('RoomController', ['ngSanitize', 'mFileInput'])
// set target_user_id to keep things clear // set target_user_id to keep things clear
var target_user_id = chunk.state_key; var target_user_id = chunk.state_key;
var now = new Date().getTime();
var isNewMember = !(target_user_id in $scope.members); var isNewMember = !(target_user_id in $scope.members);
if (isNewMember) { if (isNewMember) {
// FIXME: why are we copying these fields around inside chunk? // FIXME: why are we copying these fields around inside chunk?
@ -174,6 +172,8 @@ angular.module('RoomController', ['ngSanitize', 'mFileInput'])
} }
if ("last_active_ago" in chunk.content) { if ("last_active_ago" in chunk.content) {
chunk.last_active_ago = chunk.content.last_active_ago; chunk.last_active_ago = chunk.content.last_active_ago;
$scope.now = new Date().getTime();
chunk.last_updated = $scope.now;
} }
if ("displayname" in chunk.content) { if ("displayname" in chunk.content) {
chunk.displayname = chunk.content.displayname; chunk.displayname = chunk.content.displayname;
@ -181,7 +181,6 @@ angular.module('RoomController', ['ngSanitize', 'mFileInput'])
if ("avatar_url" in chunk.content) { if ("avatar_url" in chunk.content) {
chunk.avatar_url = chunk.content.avatar_url; chunk.avatar_url = chunk.content.avatar_url;
} }
chunk.last_updated = now;
$scope.members[target_user_id] = chunk; $scope.members[target_user_id] = chunk;
if (target_user_id in $rootScope.presence) { if (target_user_id in $rootScope.presence) {
@ -197,6 +196,8 @@ angular.module('RoomController', ['ngSanitize', 'mFileInput'])
} }
if ("last_active_ago" in chunk.content) { if ("last_active_ago" in chunk.content) {
member.last_active_ago = chunk.content.last_active_ago; member.last_active_ago = chunk.content.last_active_ago;
$scope.now = new Date().getTime();
member.last_updated = $scope.now;
} }
} }
}; };
@ -221,6 +222,8 @@ angular.module('RoomController', ['ngSanitize', 'mFileInput'])
if ("last_active_ago" in chunk.content) { if ("last_active_ago" in chunk.content) {
member.last_active_ago = chunk.content.last_active_ago; member.last_active_ago = chunk.content.last_active_ago;
$scope.now = new Date().getTime();
member.last_updated = $scope.now;
} }
// this may also contain a new display name or avatar url, so check. // this may also contain a new display name or avatar url, so check.
@ -332,10 +335,6 @@ angular.module('RoomController', ['ngSanitize', 'mFileInput'])
eventHandlerService.waitForInitialSyncCompletion().then( eventHandlerService.waitForInitialSyncCompletion().then(
function() { function() {
// Some data has been retrieved from the iniialSync request
// So, the relative time starts here
$scope.now = new Date().getTime();
var needsToJoin = true; var needsToJoin = true;
// The room members is available in the data fetched by initialSync // The room members is available in the data fetched by initialSync