summary refs log tree commit diff
diff options
context:
space:
mode:
authorEmmanuel ROHEE <erohee@amdocs.com>2014-09-01 19:09:17 +0200
committerEmmanuel ROHEE <erohee@amdocs.com>2014-09-01 19:09:49 +0200
commit0271e8e692ba2cedb2bea5a1deca81c1dc5f67eb (patch)
treeb59ccd2e709939f9f9be8859da59062bae2c1232
parentSmall formatting errors (diff)
downloadsynapse-0271e8e692ba2cedb2bea5a1deca81c1dc5f67eb.tar.xz
Follow API renaming. state -> presence. mtime_ago -> last_active_ago
-rw-r--r--webclient/app-filter.js2
-rw-r--r--webclient/room/room-controller.js25
-rw-r--r--webclient/room/room.html4
3 files changed, 15 insertions, 16 deletions
diff --git a/webclient/app-filter.js b/webclient/app-filter.js
index 124f4ebb48..b8d3d2a0d8 100644
--- a/webclient/app-filter.js
+++ b/webclient/app-filter.js
@@ -70,7 +70,7 @@ angular.module('matrixWebClient')
         });
 
         filtered.sort(function (a, b) {
-            return ((a["mtime_age"] || 10e10) > (b["mtime_age"] || 10e10) ? 1 : -1);
+            return ((a["last_active_ago"] || 10e10) > (b["last_active_ago"] || 10e10) ? 1 : -1);
         });
         return filtered;
     };
diff --git a/webclient/room/room-controller.js b/webclient/room/room-controller.js
index b20a72f25b..9861b25617 100644
--- a/webclient/room/room-controller.js
+++ b/webclient/room/room-controller.js
@@ -165,11 +165,11 @@ angular.module('RoomController', ['ngSanitize', 'mFileInput'])
         var isNewMember = !(target_user_id in $scope.members);
         if (isNewMember) {
             // FIXME: why are we copying these fields around inside chunk?
-            if ("state" in chunk.content) {
-                chunk.presenceState = chunk.content.state; // why is this renamed?
+            if ("presence" in chunk.content) {
+                chunk.presence = chunk.content.presence;
             }
-            if ("mtime_age" in chunk.content) {
-                chunk.mtime_age = chunk.content.mtime_age;
+            if ("last_active_ago" in chunk.content) {
+                chunk.last_active_ago = chunk.content.last_active_ago;
             }
             if ("displayname" in chunk.content) {
                 chunk.displayname = chunk.content.displayname;
@@ -188,11 +188,11 @@ angular.module('RoomController', ['ngSanitize', 'mFileInput'])
             // selectively update membership and presence else it will nuke the picture and displayname too :/
             var member = $scope.members[target_user_id];
             member.membership = chunk.content.membership;
-            if ("state" in chunk.content) {
-                member.presenceState = chunk.content.state;
+            if ("presence" in chunk.content) {
+                member.presence = chunk.content.presence;
             }
-            if ("mtime_age" in chunk.content) {
-                member.mtime_age = chunk.content.mtime_age;
+            if ("last_active_ago" in chunk.content) {
+                member.last_active_ago = chunk.content.last_active_ago;
             }
         }
     };
@@ -211,13 +211,12 @@ angular.module('RoomController', ['ngSanitize', 'mFileInput'])
         var member = $scope.members[chunk.content.user_id];
 
         // XXX: why not just pass the chunk straight through?
-        if ("state" in chunk.content) {
-            member.presenceState = chunk.content.state;
+        if ("presence" in chunk.content) {
+            member.presence = chunk.content.presence;
         }
 
-        if ("mtime_age" in chunk.content) {
-            // FIXME: should probably keep updating mtime_age in realtime like FB does
-            member.mtime_age = chunk.content.mtime_age;
+        if ("last_active_ago" in chunk.content) {
+            member.last_active_ago = chunk.content.last_active_ago;
         }
 
         // this may also contain a new display name or avatar url, so check.
diff --git a/webclient/room/room.html b/webclient/room/room.html
index f118461e6b..e25c837aa0 100644
--- a/webclient/room/room.html
+++ b/webclient/room/room.html
@@ -26,8 +26,8 @@
                     <img class="userAvatarGradient" src="img/gradient.png" title="{{ member.id }}" width="80" height="24"/>
                     <div class="userName">{{ member.displayname || member.id.substr(0, member.id.indexOf(':')) }}<br/>{{ member.displayname ? "" : member.id.substr(member.id.indexOf(':')) }}</div>
                 </td>
-                <td class="userPresence" ng-class="(member.presenceState === 'online' ? 'online' : (member.presenceState === 'unavailable' ? 'unavailable' : '')) + ' ' + (member.membership == 'invite' ? 'invited' : '')">
-                    <span ng-show="member.mtime_age">{{ member.mtime_age + (now - member.last_updated) | duration }}<br/>ago</span>
+                <td class="userPresence" ng-class="(member.presence === 'online' ? 'online' : (member.presence === 'unavailable' ? 'unavailable' : '')) + ' ' + (member.membership == 'invite' ? 'invited' : '')">
+                    <span ng-show="member.last_active_ago">{{ member.last_active_ago + (now - member.last_updated) | duration }}<br/>ago</span>
                 </td>
         </table>
     </div>