forked from MirrorHub/synapse
Renaming: /im/sync >> /initialSync. /rooms/$roomid/members/list >> /rooms/$roomid/members. /rooms$roomid/messages/list >> /room/$roomid/messages. Updated cmdclient, tests and webclient.
This commit is contained in:
parent
ac21dfff6d
commit
2e70de09b9
6 changed files with 16 additions and 15 deletions
|
@ -436,7 +436,7 @@ class SynapseCmd(cmd.Cmd):
|
||||||
print "Unrecognised type: %s" % args["type"]
|
print "Unrecognised type: %s" % args["type"]
|
||||||
return
|
return
|
||||||
room_id = args["roomid"]
|
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()}
|
qp = {"access_token": self._tok()}
|
||||||
if "qp" in args:
|
if "qp" in args:
|
||||||
|
|
|
@ -15,7 +15,8 @@
|
||||||
|
|
||||||
|
|
||||||
from . import (
|
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)
|
profile.register_servlets(hs, client_resource)
|
||||||
public.register_servlets(hs, client_resource)
|
public.register_servlets(hs, client_resource)
|
||||||
presence.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)
|
directory.register_servlets(hs, client_resource)
|
||||||
|
|
|
@ -19,8 +19,8 @@ from synapse.api.streams import PaginationConfig
|
||||||
from base import RestServlet, client_path_pattern
|
from base import RestServlet, client_path_pattern
|
||||||
|
|
||||||
|
|
||||||
class ImSyncRestServlet(RestServlet):
|
class InitialSyncRestServlet(RestServlet):
|
||||||
PATTERN = client_path_pattern("/im/sync$")
|
PATTERN = client_path_pattern("/initialSync$")
|
||||||
|
|
||||||
@defer.inlineCallbacks
|
@defer.inlineCallbacks
|
||||||
def on_GET(self, request):
|
def on_GET(self, request):
|
||||||
|
@ -37,4 +37,4 @@ class ImSyncRestServlet(RestServlet):
|
||||||
|
|
||||||
|
|
||||||
def register_servlets(hs, http_server):
|
def register_servlets(hs, http_server):
|
||||||
ImSyncRestServlet(hs).register(http_server)
|
InitialSyncRestServlet(hs).register(http_server)
|
|
@ -306,7 +306,7 @@ class FeedbackRestServlet(RestServlet):
|
||||||
|
|
||||||
|
|
||||||
class RoomMemberListRestServlet(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
|
@defer.inlineCallbacks
|
||||||
def on_GET(self, request, room_id):
|
def on_GET(self, request, room_id):
|
||||||
|
@ -333,7 +333,7 @@ class RoomMemberListRestServlet(RestServlet):
|
||||||
|
|
||||||
|
|
||||||
class RoomMessageListRestServlet(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
|
@defer.inlineCallbacks
|
||||||
def on_GET(self, request, room_id):
|
def on_GET(self, request, room_id):
|
||||||
|
|
|
@ -426,13 +426,13 @@ class RoomsMemberListTestCase(RestTestCase):
|
||||||
room_id = "!aa:test"
|
room_id = "!aa:test"
|
||||||
yield self.create_room_as(room_id, self.user_id)
|
yield self.create_room_as(room_id, self.user_id)
|
||||||
(code, response) = yield self.mock_resource.trigger_get(
|
(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))
|
self.assertEquals(200, code, msg=str(response))
|
||||||
|
|
||||||
@defer.inlineCallbacks
|
@defer.inlineCallbacks
|
||||||
def test_get_member_list_no_room(self):
|
def test_get_member_list_no_room(self):
|
||||||
(code, response) = yield self.mock_resource.trigger_get(
|
(code, response) = yield self.mock_resource.trigger_get(
|
||||||
"/rooms/roomdoesnotexist/members/list")
|
"/rooms/roomdoesnotexist/members")
|
||||||
self.assertEquals(403, code, msg=str(response))
|
self.assertEquals(403, code, msg=str(response))
|
||||||
|
|
||||||
@defer.inlineCallbacks
|
@defer.inlineCallbacks
|
||||||
|
@ -440,14 +440,14 @@ class RoomsMemberListTestCase(RestTestCase):
|
||||||
room_id = "!bb:test"
|
room_id = "!bb:test"
|
||||||
yield self.create_room_as(room_id, "@some_other_guy:red")
|
yield self.create_room_as(room_id, "@some_other_guy:red")
|
||||||
(code, response) = yield self.mock_resource.trigger_get(
|
(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))
|
self.assertEquals(403, code, msg=str(response))
|
||||||
|
|
||||||
@defer.inlineCallbacks
|
@defer.inlineCallbacks
|
||||||
def test_get_member_list_mixed_memberships(self):
|
def test_get_member_list_mixed_memberships(self):
|
||||||
room_id = "!bb:test"
|
room_id = "!bb:test"
|
||||||
room_creator = "@some_other_guy:blue"
|
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.create_room_as(room_id, room_creator)
|
||||||
yield self.invite(room=room_id, src=room_creator,
|
yield self.invite(room=room_id, src=room_creator,
|
||||||
targ=self.user_id)
|
targ=self.user_id)
|
||||||
|
|
|
@ -108,7 +108,7 @@ angular.module('matrixService', [])
|
||||||
// List all rooms joined or been invited to
|
// List all rooms joined or been invited to
|
||||||
rooms: function(from, to, limit) {
|
rooms: function(from, to, limit) {
|
||||||
// The REST path spec
|
// The REST path spec
|
||||||
var path = "/im/sync";
|
var path = "/initialSync";
|
||||||
|
|
||||||
return doRequest("GET", path);
|
return doRequest("GET", path);
|
||||||
},
|
},
|
||||||
|
@ -217,13 +217,13 @@ angular.module('matrixService', [])
|
||||||
// Like the cmd client, escape room ids
|
// Like the cmd client, escape room ids
|
||||||
room_id = encodeURIComponent(room_id);
|
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);
|
path = path.replace("$room_id", room_id);
|
||||||
return doRequest("GET", path);
|
return doRequest("GET", path);
|
||||||
},
|
},
|
||||||
|
|
||||||
paginateBackMessages: function(room_id, from_token, limit) {
|
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);
|
path = path.replace("$room_id", room_id);
|
||||||
var params = {
|
var params = {
|
||||||
from: from_token,
|
from: from_token,
|
||||||
|
|
Loading…
Reference in a new issue