Migrate to idiomatic error handling in app/security_update_check.go (#9691)

Этот коммит содержится в:
Hanzei
2018-10-18 17:44:06 +02:00
коммит произвёл Christopher Speller
родитель 5d6d450299
Коммит d77e3a4c25

Просмотреть файл

@@ -86,10 +86,11 @@ func (a *App) DoSecurityUpdateCheck() {
for _, bulletin := range bulletins { for _, bulletin := range bulletins {
if bulletin.AppliesToVersion == model.CurrentVersion { if bulletin.AppliesToVersion == model.CurrentVersion {
if props["SecurityBulletin_"+bulletin.Id] == "" { 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.") mlog.Error("Failed to get system admins for security update information from Mattermost.")
return return
} else { }
users := results.Data.(map[string]*model.User) users := results.Data.(map[string]*model.User)
resBody, err := http.Get(SECURITY_URL + "/bulletins/" + bulletin.Id) resBody, err := http.Get(SECURITY_URL + "/bulletins/" + bulletin.Id)
@@ -109,7 +110,6 @@ func (a *App) DoSecurityUpdateCheck() {
mlog.Info(fmt.Sprintf("Sending security bulletin for %v to %v", bulletin.Id, user.Email)) 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)) a.SendMail(user.Email, utils.T("mattermost.bulletin.subject"), string(body))
} }
}
bulletinSeen := &model.System{Name: "SecurityBulletin_" + bulletin.Id, Value: bulletin.Id} bulletinSeen := &model.System{Name: "SecurityBulletin_" + bulletin.Id, Value: bulletin.Id}
<-a.Srv.Store.System().Save(bulletinSeen) <-a.Srv.Store.System().Save(bulletinSeen)