mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2025-05-02 10:56:06 -04:00
Simplify room creation code
This commit is contained in:
parent
4de08a4672
commit
e560045cfd
2 changed files with 31 additions and 55 deletions
|
@ -63,24 +63,12 @@ class RoomCreateRestServlet(ClientV1RestServlet):
|
|||
def on_POST(self, request):
|
||||
requester = yield self.auth.get_user_by_req(request)
|
||||
|
||||
room_config = self.get_room_config(request)
|
||||
info = yield self.make_room(
|
||||
room_config,
|
||||
requester.user,
|
||||
None,
|
||||
)
|
||||
room_config.update(info)
|
||||
defer.returnValue((200, info))
|
||||
|
||||
@defer.inlineCallbacks
|
||||
def make_room(self, room_config, auth_user, room_id):
|
||||
handler = self.handlers.room_creation_handler
|
||||
info = yield handler.create_room(
|
||||
user_id=auth_user.to_string(),
|
||||
room_id=room_id,
|
||||
config=room_config
|
||||
requester, self.get_room_config(request)
|
||||
)
|
||||
defer.returnValue(info)
|
||||
|
||||
defer.returnValue((200, info))
|
||||
|
||||
def get_room_config(self, request):
|
||||
try:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue