Migrate to idiomatic error handling app/a*.go and app/b*.go (#9455)
Этот коммит содержится в:
коммит произвёл
Joram Wilander
родитель
3785ad48c1
Коммит
7636650a25
15
app/admin.go
15
app/admin.go
@@ -238,14 +238,15 @@ func (a *App) TestEmail(userId string, cfg *model.Config) *model.AppError {
|
||||
return model.NewAppError("testEmail", "api.admin.test_email.reenter_password", nil, "", http.StatusBadRequest)
|
||||
}
|
||||
}
|
||||
if user, err := a.GetUser(userId); err != nil {
|
||||
user, err := a.GetUser(userId)
|
||||
if err != nil {
|
||||
return err
|
||||
} else {
|
||||
T := utils.GetUserTranslations(user.Locale)
|
||||
license := a.License()
|
||||
if err := mailservice.SendMailUsingConfig(user.Email, T("api.admin.test_email.subject"), T("api.admin.test_email.body"), cfg, license != nil && *license.Features.Compliance); err != nil {
|
||||
return model.NewAppError("testEmail", "app.admin.test_email.failure", map[string]interface{}{"Error": err.Error()}, "", http.StatusInternalServerError)
|
||||
}
|
||||
}
|
||||
|
||||
T := utils.GetUserTranslations(user.Locale)
|
||||
license := a.License()
|
||||
if err := mailservice.SendMailUsingConfig(user.Email, T("api.admin.test_email.subject"), T("api.admin.test_email.body"), cfg, license != nil && *license.Features.Compliance); err != nil {
|
||||
return model.NewAppError("testEmail", "app.admin.test_email.failure", map[string]interface{}{"Error": err.Error()}, "", http.StatusInternalServerError)
|
||||
}
|
||||
|
||||
return nil
|
||||
|
||||
Ссылка в новой задаче
Block a user