summary refs log tree commit diff
path: root/webclient/room/room-controller.js
diff options
context:
space:
mode:
authorMatthew Hodgson <matthew@matrix.org>2014-08-16 01:07:23 +0100
committerMatthew Hodgson <matthew@matrix.org>2014-08-16 01:07:23 +0100
commit207ef144c5e5d7db16d42c6f15b8efc33a354e92 (patch)
tree861fab2f8f8d08fe3afb3c85caaf199814fd3877 /webclient/room/room-controller.js
parentslightly hacky but more functional infinite scrolling (diff)
downloadsynapse-207ef144c5e5d7db16d42c6f15b8efc33a354e92.tar.xz
display mtime_age in webclient
Diffstat (limited to 'webclient/room/room-controller.js')
-rw-r--r--webclient/room/room-controller.js19
1 files changed, 10 insertions, 9 deletions
diff --git a/webclient/room/room-controller.js b/webclient/room/room-controller.js
index a53d375cf8..134247917a 100644
--- a/webclient/room/room-controller.js
+++ b/webclient/room/room-controller.js
@@ -120,6 +120,9 @@ angular.module('RoomController', [])
             if ("state" in chunk.content) {
                 chunk.presenceState = chunk.content.state;
             }
+            if ("mtime_age" in chunk.content) {
+                chunk.mtime_age = chunk.content.mtime_age;
+            }
         
             $scope.members[chunk.target_user_id] = chunk;
             // get their display name and profile picture and set it to their
@@ -160,16 +163,14 @@ angular.module('RoomController', [])
         }
         var member = $scope.members[chunk.content.user_id];
 
+        // XXX: why not just pass the chunk straight through?
         if ("state" in chunk.content) {
-            if (chunk.content.state === "online") {
-                member.presenceState = "online";
-            }
-            else if (chunk.content.state === "offline") {
-                member.presenceState = "offline";
-            }
-            else if (chunk.content.state === "unavailable") {
-                member.presenceState = "unavailable";
-            }
+            member.presenceState = chunk.content.state;
+        }
+
+        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;
         }
 
         // this may also contain a new display name or avatar url, so check.