summary refs log tree commit diff
diff options
context:
space:
mode:
authorEmmanuel ROHEE <erohee@amdocs.com>2014-09-23 17:25:37 +0200
committerEmmanuel ROHEE <erohee@amdocs.com>2014-09-23 17:33:16 +0200
commite4e8ad6780abd63f766db13974ddc3d3c4f7528f (patch)
treecdd43fe715d7a0330e85949aeee64a9dc5780f1b
parentMerge branch 'jira/SYN-60' into develop (diff)
downloadsynapse-e4e8ad6780abd63f766db13974ddc3d3c4f7528f.tar.xz
SYWEB-28: Fixed weird members list ordering: sort members on their last activity absolute time
-rw-r--r--webclient/app-filter.js13
1 files changed, 10 insertions, 3 deletions
diff --git a/webclient/app-filter.js b/webclient/app-filter.js
index 0d059e1621..9443446c9f 100644
--- a/webclient/app-filter.js
+++ b/webclient/app-filter.js
@@ -70,9 +70,16 @@ angular.module('matrixWebClient')
         });
 
         filtered.sort(function (a, b) {
-            // Sort members on their last_active_ago value
-            if (undefined !== a.last_active_ago || undefined !== b.last_active_ago) {
-                return ((a.last_active_ago || 10e10) > (b.last_active_ago || 10e10) ? 1 : -1);
+            // Sort members on their last_active absolute time
+            var aLastActiveTS = 0, bLastActiveTS = 0;
+            if (undefined !== a.last_active_ago) {
+                aLastActiveTS = a.last_updated - a.last_active_ago;
+            }
+            if (undefined !== b.last_active_ago) {
+                bLastActiveTS = b.last_updated - b.last_active_ago;
+            }
+            if (aLastActiveTS || bLastActiveTS) {
+                return bLastActiveTS - aLastActiveTS;
             }
             else {
                 // If they do not have last_active_ago, sort them according to their presence state