summary refs log tree commit diff
diff options
context:
space:
mode:
authorKegan Dougal <kegan@matrix.org>2014-09-03 12:09:11 +0100
committerKegan Dougal <kegan@matrix.org>2014-09-03 12:09:20 +0100
commitdfea1730dcb7f75189ede3f8ee71c5421d2aa5ed (patch)
treeb88dc5cf588a415c2f0497fe330619dc6d81c713
parentMerge branch 'develop' of github.com:matrix-org/synapse into develop (diff)
downloadsynapse-dfea1730dcb7f75189ede3f8ee71c5421d2aa5ed.tar.xz
apidocs: mtime_age > last_active_ago. Presence REST: Sanity check values in invite/drop arrays.
-rw-r--r--docs/client-server/swagger_matrix/api-docs-presence4
-rw-r--r--synapse/rest/presence.py8
2 files changed, 10 insertions, 2 deletions
diff --git a/docs/client-server/swagger_matrix/api-docs-presence b/docs/client-server/swagger_matrix/api-docs-presence
index 5c9f160508..6b22446024 100644
--- a/docs/client-server/swagger_matrix/api-docs-presence
+++ b/docs/client-server/swagger_matrix/api-docs-presence
@@ -128,10 +128,10 @@
     "Presence": {
       "id": "Presence",
       "properties": {
-        "mtime_age": {
+        "last_active_ago": {
           "type": "integer",
           "format": "int64",
-          "description": "The last time this user's presence state changed, in milliseconds."
+          "description": "The last time this user performed an action on their home server."
         },
         "user_id": {
           "type": "string",
diff --git a/synapse/rest/presence.py b/synapse/rest/presence.py
index 69be6fe989..5c5adb4236 100644
--- a/synapse/rest/presence.py
+++ b/synapse/rest/presence.py
@@ -125,12 +125,20 @@ class PresenceListRestServlet(RestServlet):
 
         if "invite" in content:
             for u in content["invite"]:
+                if not isinstance(u, basestring):
+                    raise SynapseError(400, "Bad invite value.")
+                if len(u) == 0:
+                    continue
                 invited_user = self.hs.parse_userid(u)
                 deferreds.append(self.handlers.presence_handler.send_invite(
                     observer_user=user, observed_user=invited_user))
 
         if "drop" in content:
             for u in content["drop"]:
+                if not isinstance(u, basestring):
+                    raise SynapseError(400, "Bad drop value.")
+                if len(u) == 0:
+                    continue
                 dropped_user = self.hs.parse_userid(u)
                 deferreds.append(self.handlers.presence_handler.drop(
                     observer_user=user, observed_user=dropped_user))