Don't require preset to create room (#496)
* Don't require preset to create room * Set defaults if no preset. Use switch instead of if * Add default case and comment to r.Preset switch
This commit is contained in:
parent
7736e247b7
commit
7f7ae65098
|
@ -88,8 +88,7 @@ func (r createRoomRequest) Validate() *util.JSONResponse {
|
|||
}
|
||||
}
|
||||
switch r.Preset {
|
||||
case presetPrivateChat, presetTrustedPrivateChat, presetPublicChat:
|
||||
break
|
||||
case presetPrivateChat, presetTrustedPrivateChat, presetPublicChat, "":
|
||||
default:
|
||||
return &util.JSONResponse{
|
||||
Code: http.StatusBadRequest,
|
||||
|
@ -181,6 +180,11 @@ func createRoom(req *http.Request, device *authtypes.Device,
|
|||
case presetPublicChat:
|
||||
joinRules = joinRulePublic
|
||||
historyVisibility = historyVisibilityShared
|
||||
default:
|
||||
// Default room rules, r.Preset was previously checked for valid values so
|
||||
// only a request with no preset should end up here.
|
||||
joinRules = joinRuleInvite
|
||||
historyVisibility = historyVisibilityShared
|
||||
}
|
||||
|
||||
var builtEvents []gomatrixserverlib.Event
|
||||
|
|
Loading…
Reference in a new issue