summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHanzei <16541325+hanzei@users.noreply.github.com>2018-10-18 17:44:06 +0200
committerChristopher Speller <crspeller@gmail.com>2018-10-18 08:44:06 -0700
commitd77e3a4c2501ab9d0124b09f1b2d70554e686070 (patch)
tree5f69f92121253f4349cad9309fcc9994ec507b54
parent5d6d4502992af4120fed19a9db43960d6269b871 (diff)
downloadchat-d77e3a4c2501ab9d0124b09f1b2d70554e686070.tar.gz
chat-d77e3a4c2501ab9d0124b09f1b2d70554e686070.tar.bz2
chat-d77e3a4c2501ab9d0124b09f1b2d70554e686070.zip
Migrate to idiomatic error handling in app/security_update_check.go (#9691)
-rw-r--r--app/security_update_check.go42
1 files changed, 21 insertions, 21 deletions
diff --git a/app/security_update_check.go b/app/security_update_check.go
index f5b50c1c6..39c1a6ee9 100644
--- a/app/security_update_check.go
+++ b/app/security_update_check.go
@@ -86,29 +86,29 @@ func (a *App) DoSecurityUpdateCheck() {
for _, bulletin := range bulletins {
if bulletin.AppliesToVersion == model.CurrentVersion {
if props["SecurityBulletin_"+bulletin.Id] == "" {
- if results := <-a.Srv.Store.User().GetSystemAdminProfiles(); results.Err != nil {
+ results := <-a.Srv.Store.User().GetSystemAdminProfiles()
+ if results.Err != nil {
mlog.Error("Failed to get system admins for security update information from Mattermost.")
return
- } else {
- users := results.Data.(map[string]*model.User)
-
- resBody, err := http.Get(SECURITY_URL + "/bulletins/" + bulletin.Id)
- if err != nil {
- mlog.Error("Failed to get security bulletin details")
- return
- }
-
- body, err := ioutil.ReadAll(resBody.Body)
- res.Body.Close()
- if err != nil || resBody.StatusCode != 200 {
- mlog.Error("Failed to read security bulletin details")
- return
- }
-
- for _, user := range users {
- mlog.Info(fmt.Sprintf("Sending security bulletin for %v to %v", bulletin.Id, user.Email))
- a.SendMail(user.Email, utils.T("mattermost.bulletin.subject"), string(body))
- }
+ }
+ users := results.Data.(map[string]*model.User)
+
+ resBody, err := http.Get(SECURITY_URL + "/bulletins/" + bulletin.Id)
+ if err != nil {
+ mlog.Error("Failed to get security bulletin details")
+ return
+ }
+
+ body, err := ioutil.ReadAll(resBody.Body)
+ res.Body.Close()
+ if err != nil || resBody.StatusCode != 200 {
+ mlog.Error("Failed to read security bulletin details")
+ return
+ }
+
+ for _, user := range users {
+ mlog.Info(fmt.Sprintf("Sending security bulletin for %v to %v", bulletin.Id, user.Email))
+ a.SendMail(user.Email, utils.T("mattermost.bulletin.subject"), string(body))
}
bulletinSeen := &model.System{Name: "SecurityBulletin_" + bulletin.Id, Value: bulletin.Id}