summary refs log tree commit diff
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2014-08-26 16:29:44 +0100
committerErik Johnston <erik@matrix.org>2014-08-26 16:29:44 +0100
commit8885c8546c3493ada2f00b1626d45fa90109ab5f (patch)
tree7dbe04a84413a4511bcc3ef62d227659052cefa7
parentMerge branch 'develop' of github.com:matrix-org/synapse into stream_refactor (diff)
parentRespect 'limit' param in initialSync api (diff)
downloadsynapse-8885c8546c3493ada2f00b1626d45fa90109ab5f.tar.xz
Merge branch 'develop' of github.com:matrix-org/synapse into stream_refactor
-rwxr-xr-xcmdclient/console.py2
-rw-r--r--synapse/handlers/federation.py2
-rw-r--r--synapse/handlers/room.py6
-rw-r--r--synapse/rest/__init__.py5
-rw-r--r--synapse/rest/initial_sync.py (renamed from synapse/rest/im.py)6
-rw-r--r--synapse/rest/room.py4
-rw-r--r--tests/rest/test_rooms.py8
-rw-r--r--webclient/components/matrix/matrix-service.js6
8 files changed, 22 insertions, 17 deletions
diff --git a/cmdclient/console.py b/cmdclient/console.py
index 0fbb822010..f997b7539c 100755
--- a/cmdclient/console.py
+++ b/cmdclient/console.py
@@ -436,7 +436,7 @@ class SynapseCmd(cmd.Cmd):
             print "Unrecognised type: %s" % args["type"]
             return
         room_id = args["roomid"]
-        path = "/rooms/%s/%s/list" % (urllib.quote(room_id), args["type"])
+        path = "/rooms/%s/%s" % (urllib.quote(room_id), args["type"])
 
         qp = {"access_token": self._tok()}
         if "qp" in args:
diff --git a/synapse/handlers/federation.py b/synapse/handlers/federation.py
index 2680678de7..bfc1ab86f2 100644
--- a/synapse/handlers/federation.py
+++ b/synapse/handlers/federation.py
@@ -114,7 +114,7 @@ class FederationHandler(BaseHandler):
 
         if event.type == RoomMemberEvent.TYPE:
             if event.membership == Membership.JOIN:
-                user = self.hs.parse_userid(event.target_user_id)
+                user = self.hs.parse_userid(event.state_key)
                 self.distributor.fire(
                     "user_joined_room", user=user, room_id=event.room_id
                 )
diff --git a/synapse/handlers/room.py b/synapse/handlers/room.py
index c2b10f4189..5a4569ac95 100644
--- a/synapse/handlers/room.py
+++ b/synapse/handlers/room.py
@@ -270,6 +270,10 @@ class MessageHandler(BaseHandler):
         # FIXME (erikj): We need to not generate this token,
         now_token = "%s_%s" % (now_rooms_token, now_presence_token)
 
+        limit = pagin_config.limit
+        if not limit:
+            limit = 10
+
         for event in room_list:
             d = {
                 "room_id": event.room_id,
@@ -286,7 +290,7 @@ class MessageHandler(BaseHandler):
             try:
                 messages, token = yield self.store.get_recent_events_for_room(
                     event.room_id,
-                    limit=10,
+                    limit=limit,
                     end_token=now_rooms_token,
                 )
 
diff --git a/synapse/rest/__init__.py b/synapse/rest/__init__.py
index da18933b63..47896612ce 100644
--- a/synapse/rest/__init__.py
+++ b/synapse/rest/__init__.py
@@ -15,7 +15,8 @@
 
 
 from . import (
-    room, events, register, login, profile, public, presence, im, directory
+    room, events, register, login, profile, public, presence, initial_sync,
+    directory
 )
 
 
@@ -41,5 +42,5 @@ class RestServletFactory(object):
         profile.register_servlets(hs, client_resource)
         public.register_servlets(hs, client_resource)
         presence.register_servlets(hs, client_resource)
-        im.register_servlets(hs, client_resource)
+        initial_sync.register_servlets(hs, client_resource)
         directory.register_servlets(hs, client_resource)
diff --git a/synapse/rest/im.py b/synapse/rest/initial_sync.py
index 63a77716a0..fab748f562 100644
--- a/synapse/rest/im.py
+++ b/synapse/rest/initial_sync.py
@@ -19,8 +19,8 @@ from synapse.api.streams import PaginationConfig
 from base import RestServlet, client_path_pattern
 
 
-class ImSyncRestServlet(RestServlet):
-    PATTERN = client_path_pattern("/im/sync$")
+class InitialSyncRestServlet(RestServlet):
+    PATTERN = client_path_pattern("/initialSync$")
 
     @defer.inlineCallbacks
     def on_GET(self, request):
@@ -37,4 +37,4 @@ class ImSyncRestServlet(RestServlet):
 
 
 def register_servlets(hs, http_server):
-    ImSyncRestServlet(hs).register(http_server)
+    InitialSyncRestServlet(hs).register(http_server)
diff --git a/synapse/rest/room.py b/synapse/rest/room.py
index 6771da8fcd..b031ad1bc4 100644
--- a/synapse/rest/room.py
+++ b/synapse/rest/room.py
@@ -306,7 +306,7 @@ class FeedbackRestServlet(RestServlet):
 
 
 class RoomMemberListRestServlet(RestServlet):
-    PATTERN = client_path_pattern("/rooms/(?P<room_id>[^/]*)/members/list$")
+    PATTERN = client_path_pattern("/rooms/(?P<room_id>[^/]*)/members$")
 
     @defer.inlineCallbacks
     def on_GET(self, request, room_id):
@@ -333,7 +333,7 @@ class RoomMemberListRestServlet(RestServlet):
 
 
 class RoomMessageListRestServlet(RestServlet):
-    PATTERN = client_path_pattern("/rooms/(?P<room_id>[^/]*)/messages/list$")
+    PATTERN = client_path_pattern("/rooms/(?P<room_id>[^/]*)/messages$")
 
     @defer.inlineCallbacks
     def on_GET(self, request, room_id):
diff --git a/tests/rest/test_rooms.py b/tests/rest/test_rooms.py
index b932ca02e0..8514d6ba21 100644
--- a/tests/rest/test_rooms.py
+++ b/tests/rest/test_rooms.py
@@ -426,13 +426,13 @@ class RoomsMemberListTestCase(RestTestCase):
         room_id = "!aa:test"
         yield self.create_room_as(room_id, self.user_id)
         (code, response) = yield self.mock_resource.trigger_get(
-                           "/rooms/%s/members/list" % room_id)
+                           "/rooms/%s/members" % room_id)
         self.assertEquals(200, code, msg=str(response))
 
     @defer.inlineCallbacks
     def test_get_member_list_no_room(self):
         (code, response) = yield self.mock_resource.trigger_get(
-                           "/rooms/roomdoesnotexist/members/list")
+                           "/rooms/roomdoesnotexist/members")
         self.assertEquals(403, code, msg=str(response))
 
     @defer.inlineCallbacks
@@ -440,14 +440,14 @@ class RoomsMemberListTestCase(RestTestCase):
         room_id = "!bb:test"
         yield self.create_room_as(room_id, "@some_other_guy:red")
         (code, response) = yield self.mock_resource.trigger_get(
-                           "/rooms/%s/members/list" % room_id)
+                           "/rooms/%s/members" % room_id)
         self.assertEquals(403, code, msg=str(response))
 
     @defer.inlineCallbacks
     def test_get_member_list_mixed_memberships(self):
         room_id = "!bb:test"
         room_creator = "@some_other_guy:blue"
-        room_path = "/rooms/%s/members/list" % room_id
+        room_path = "/rooms/%s/members" % room_id
         yield self.create_room_as(room_id, room_creator)
         yield self.invite(room=room_id, src=room_creator,
                           targ=self.user_id)
diff --git a/webclient/components/matrix/matrix-service.js b/webclient/components/matrix/matrix-service.js
index 237dd6d8a0..fe5f120aaf 100644
--- a/webclient/components/matrix/matrix-service.js
+++ b/webclient/components/matrix/matrix-service.js
@@ -108,7 +108,7 @@ angular.module('matrixService', [])
         // List all rooms joined or been invited to
         rooms: function(from, to, limit) {
             // The REST path spec
-            var path = "/im/sync";
+            var path = "/initialSync";
 
             return doRequest("GET", path);
         },
@@ -217,13 +217,13 @@ angular.module('matrixService', [])
             // Like the cmd client, escape room ids
             room_id = encodeURIComponent(room_id);
 
-            var path = "/rooms/$room_id/members/list";
+            var path = "/rooms/$room_id/members";
             path = path.replace("$room_id", room_id);
             return doRequest("GET", path);
         },
         
         paginateBackMessages: function(room_id, from_token, limit) {
-            var path = "/rooms/$room_id/messages/list";
+            var path = "/rooms/$room_id/messages";
             path = path.replace("$room_id", room_id);
             var params = {
                 from: from_token,