From 533e5dba5a81ee9ff8880392016022e7ac675807 Mon Sep 17 00:00:00 2001 From: Kegan Dougal Date: Thu, 9 Mar 2017 10:51:35 +0000 Subject: [PATCH] Review comments --- .../dendrite/clientapi/writers/createroom.go | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/github.com/matrix-org/dendrite/clientapi/writers/createroom.go b/src/github.com/matrix-org/dendrite/clientapi/writers/createroom.go index 66a57acbe..1dde64e74 100644 --- a/src/github.com/matrix-org/dendrite/clientapi/writers/createroom.go +++ b/src/github.com/matrix-org/dendrite/clientapi/writers/createroom.go @@ -66,6 +66,15 @@ type createRoomResponse struct { // CreateRoom implements /createRoom func CreateRoom(req *http.Request) util.JSONResponse { + serverName := "localhost" + // TODO: Check room ID doesn't clash with an existing one, and we + // probably shouldn't be using pseudo-random strings, maybe GUIDs? + roomID := fmt.Sprintf("!%s:%s", util.RandomString(16), serverName) + return createRoom(req, roomID) +} + +// createRoom implements /createRoom +func createRoom(req *http.Request, roomID string) util.JSONResponse { logger := util.GetLogger(req.Context()) userID, resErr := auth.VerifyAccessToken(req) if resErr != nil { @@ -84,9 +93,6 @@ func CreateRoom(req *http.Request) util.JSONResponse { // TODO: visibility/presets/raw initial state/creation content - serverName := "localhost" - roomID := fmt.Sprintf("!%s:%s", util.RandomString(16), serverName) - // TODO: Check room ID doesn't clash with an existing one // TODO: Create room alias association logger.WithFields(log.Fields{