Allow SyTest's 30createroom test to pass

Dendrite was requiring "preset" as a parameter to createroom when it's
not a required field.
This commit is contained in:
Andrew Morgan 2018-05-24 13:50:50 +01:00
parent ed388a32b7
commit f5e94f0e95

View file

@ -87,6 +87,9 @@ func (r createRoomRequest) Validate() *util.JSONResponse {
} }
} }
} }
// If set, ensure r.Preset is one of allowed types
if r.Preset != "" {
switch r.Preset { switch r.Preset {
case presetPrivateChat, presetTrustedPrivateChat, presetPublicChat: case presetPrivateChat, presetTrustedPrivateChat, presetPublicChat:
break break
@ -96,6 +99,7 @@ func (r createRoomRequest) Validate() *util.JSONResponse {
JSON: jsonerror.BadJSON("preset must be any of 'private_chat', 'trusted_private_chat', 'public_chat'"), JSON: jsonerror.BadJSON("preset must be any of 'private_chat', 'trusted_private_chat', 'public_chat'"),
} }
} }
}
return nil return nil
} }