From 7d246f906ad205ee435ba792224212b46ba82ca0 Mon Sep 17 00:00:00 2001 From: Andrew Morgan Date: Tue, 12 Jun 2018 16:24:32 +0100 Subject: [PATCH] Don't require preset to create room --- .../dendrite/clientapi/routing/createroom.go | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/src/github.com/matrix-org/dendrite/clientapi/routing/createroom.go b/src/github.com/matrix-org/dendrite/clientapi/routing/createroom.go index edb1858d..b879fcbb 100644 --- a/src/github.com/matrix-org/dendrite/clientapi/routing/createroom.go +++ b/src/github.com/matrix-org/dendrite/clientapi/routing/createroom.go @@ -87,13 +87,15 @@ func (r createRoomRequest) Validate() *util.JSONResponse { } } } - switch r.Preset { - case presetPrivateChat, presetTrustedPrivateChat, presetPublicChat: - break - default: - return &util.JSONResponse{ - Code: http.StatusBadRequest, - JSON: jsonerror.BadJSON("preset must be any of 'private_chat', 'trusted_private_chat', 'public_chat'"), + if r.Preset != "" { + switch r.Preset { + case presetPrivateChat, presetTrustedPrivateChat, presetPublicChat: + break + default: + return &util.JSONResponse{ + Code: http.StatusBadRequest, + JSON: jsonerror.BadJSON("preset must be any of 'private_chat', 'trusted_private_chat', 'public_chat'"), + } } }