MM-9983 Requiring SiteURL to be set. (#8769)
* Requiring SiteURL to be set. * Modifying to make tests pass. * Fixing test.
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
d5e1f7e298
Коммит
0432f995ec
@@ -1870,18 +1870,10 @@ func (o *Config) SetDefaults() {
|
||||
}
|
||||
|
||||
func (o *Config) IsValid() *AppError {
|
||||
if len(*o.ServiceSettings.SiteURL) == 0 && *o.EmailSettings.EnableEmailBatching {
|
||||
return NewAppError("Config.IsValid", "model.config.is_valid.site_url_email_batching.app_error", nil, "", http.StatusBadRequest)
|
||||
}
|
||||
|
||||
if *o.ClusterSettings.Enable && *o.EmailSettings.EnableEmailBatching {
|
||||
return NewAppError("Config.IsValid", "model.config.is_valid.cluster_email_batching.app_error", nil, "", http.StatusBadRequest)
|
||||
}
|
||||
|
||||
if len(*o.ServiceSettings.SiteURL) == 0 && *o.ServiceSettings.AllowCookiesForSubdomains {
|
||||
return NewAppError("Config.IsValid", "Allowing cookies for subdomains requires SiteURL to be set.", nil, "", http.StatusBadRequest)
|
||||
}
|
||||
|
||||
if err := o.TeamSettings.isValid(); err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -2187,12 +2179,6 @@ func (ss *ServiceSettings) isValid() *AppError {
|
||||
return NewAppError("Config.IsValid", "model.config.is_valid.login_attempts.app_error", nil, "", http.StatusBadRequest)
|
||||
}
|
||||
|
||||
if len(*ss.SiteURL) != 0 {
|
||||
if _, err := url.ParseRequestURI(*ss.SiteURL); err != nil {
|
||||
return NewAppError("Config.IsValid", "model.config.is_valid.site_url.app_error", nil, "", http.StatusBadRequest)
|
||||
}
|
||||
}
|
||||
|
||||
if len(*ss.WebsocketURL) != 0 {
|
||||
if _, err := url.ParseRequestURI(*ss.WebsocketURL); err != nil {
|
||||
return NewAppError("Config.IsValid", "model.config.is_valid.websocket_url.app_error", nil, "", http.StatusBadRequest)
|
||||
|
||||
Ссылка в новой задаче
Block a user