mirror of
https://github.com/mattermost/mattermost.git
synced 2025-02-25 18:55:24 -06:00
MM-42813: Fallback to default config if nil is passed (#19920)
https://mattermost.atlassian.net/browse/MM-42813 ```release-note NONE ``` Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
This commit is contained in:
@@ -196,11 +196,9 @@ func getSystemPing(c *Context, w http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
|
||||
func testEmail(c *Context, w http.ResponseWriter, r *http.Request) {
|
||||
var cfg *model.Config
|
||||
jsonErr := json.NewDecoder(r.Body).Decode(&cfg)
|
||||
if jsonErr != nil {
|
||||
c.Err = model.NewAppError("testEmail", "api.unmarshal_error", nil, jsonErr.Error(), http.StatusBadRequest)
|
||||
return
|
||||
cfg := model.ConfigFromJSON(r.Body)
|
||||
if cfg == nil {
|
||||
cfg = c.App.Config()
|
||||
}
|
||||
|
||||
if checkHasNilFields(&cfg.EmailSettings) {
|
||||
@@ -454,11 +452,9 @@ func getSupportedTimezones(c *Context, w http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
|
||||
func testS3(c *Context, w http.ResponseWriter, r *http.Request) {
|
||||
var cfg *model.Config
|
||||
jsonErr := json.NewDecoder(r.Body).Decode(&cfg)
|
||||
if jsonErr != nil {
|
||||
c.Err = model.NewAppError("testS3", "api.unmarshal_error", nil, jsonErr.Error(), http.StatusBadRequest)
|
||||
return
|
||||
cfg := model.ConfigFromJSON(r.Body)
|
||||
if cfg == nil {
|
||||
cfg = c.App.Config()
|
||||
}
|
||||
|
||||
if checkHasNilFields(&cfg.FileSettings) {
|
||||
|
||||
Reference in New Issue
Block a user