Skip to content
Snippets Groups Projects
Commit bcf30b29 authored by Emmanuel ROHEE's avatar Emmanuel ROHEE
Browse files

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

parent b4984d5e
No related branches found
No related tags found
No related merge requests found
...@@ -163,8 +163,6 @@ angular.module('RoomController', ['ngSanitize', 'mFileInput']) ...@@ -163,8 +163,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) {
...@@ -174,6 +172,8 @@ angular.module('RoomController', ['ngSanitize', 'mFileInput']) ...@@ -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']) ...@@ -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']) ...@@ -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']) ...@@ -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']) ...@@ -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
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment