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 {
|
switch r.Preset {
|
||||||
case presetPrivateChat, presetTrustedPrivateChat, presetPublicChat:
|
case presetPrivateChat, presetTrustedPrivateChat, presetPublicChat, "":
|
||||||
break
|
|
||||||
default:
|
default:
|
||||||
return &util.JSONResponse{
|
return &util.JSONResponse{
|
||||||
Code: http.StatusBadRequest,
|
Code: http.StatusBadRequest,
|
||||||
|
@ -181,6 +180,11 @@ func createRoom(req *http.Request, device *authtypes.Device,
|
||||||
case presetPublicChat:
|
case presetPublicChat:
|
||||||
joinRules = joinRulePublic
|
joinRules = joinRulePublic
|
||||||
historyVisibility = historyVisibilityShared
|
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
|
var builtEvents []gomatrixserverlib.Event
|
||||||
|
|
Loading…
Reference in a new issue