Fixed errcheck issues in server/channels/app/security_update_check.go (#29200)
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
b59819da68
Коммит
cdfadcf47d
@@ -104,7 +104,6 @@ issues:
|
|||||||
channels/app/plugin_test.go|\
|
channels/app/plugin_test.go|\
|
||||||
channels/app/post_helpers_test.go|\
|
channels/app/post_helpers_test.go|\
|
||||||
channels/app/post_test.go|\
|
channels/app/post_test.go|\
|
||||||
channels/app/security_update_check.go|\
|
|
||||||
channels/app/server.go|\
|
channels/app/server.go|\
|
||||||
channels/app/slack.go|\
|
channels/app/slack.go|\
|
||||||
channels/app/slashcommands/auto_environment.go|\
|
channels/app/slashcommands/auto_environment.go|\
|
||||||
|
|||||||
@@ -64,9 +64,15 @@ func (s *Server) DoSecurityUpdateCheck() {
|
|||||||
|
|
||||||
systemSecurityLastTime := &model.System{Name: model.SystemLastSecurityTime, Value: strconv.FormatInt(currentTime, 10)}
|
systemSecurityLastTime := &model.System{Name: model.SystemLastSecurityTime, Value: strconv.FormatInt(currentTime, 10)}
|
||||||
if lastSecurityTime == 0 {
|
if lastSecurityTime == 0 {
|
||||||
s.Store().System().Save(systemSecurityLastTime)
|
if err := s.Store().System().Save(systemSecurityLastTime); err != nil {
|
||||||
|
s.Log().Error("Failed to save last security check time", mlog.Err(err))
|
||||||
|
return
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
s.Store().System().Update(systemSecurityLastTime)
|
if err := s.Store().System().Update(systemSecurityLastTime); err != nil {
|
||||||
|
s.Log().Error("Failed to update last security check time", mlog.Err(err))
|
||||||
|
return
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if count, err := s.Store().User().Count(model.UserCountOptions{IncludeDeleted: true}); err == nil {
|
if count, err := s.Store().User().Count(model.UserCountOptions{IncludeDeleted: true}); err == nil {
|
||||||
@@ -121,11 +127,16 @@ func (s *Server) DoSecurityUpdateCheck() {
|
|||||||
mlog.Info("Sending security bulletin", mlog.String("bulletin_id", bulletin.Id), mlog.String("user_email", user.Email))
|
mlog.Info("Sending security bulletin", mlog.String("bulletin_id", bulletin.Id), mlog.String("user_email", user.Email))
|
||||||
license := s.License()
|
license := s.License()
|
||||||
mailConfig := s.MailServiceConfig()
|
mailConfig := s.MailServiceConfig()
|
||||||
mail.SendMailUsingConfig(user.Email, i18n.T("mattermost.bulletin.subject"), string(body), mailConfig, license != nil && *license.Features.Compliance, "", "", "", "", "SecurityUpdateCheck")
|
err = mail.SendMailUsingConfig(user.Email, i18n.T("mattermost.bulletin.subject"), string(body), mailConfig, license != nil && *license.Features.Compliance, "", "", "", "", "SecurityUpdateCheck")
|
||||||
|
if err != nil {
|
||||||
|
s.Log().Error("Failed to send security bulletin email", mlog.String("user_email", user.Email), mlog.Err(err))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bulletinSeen := &model.System{Name: "SecurityBulletin_" + bulletin.Id, Value: bulletin.Id}
|
bulletinSeen := &model.System{Name: "SecurityBulletin_" + bulletin.Id, Value: bulletin.Id}
|
||||||
s.Store().System().Save(bulletinSeen)
|
if err := s.Store().System().Save(bulletinSeen); err != nil {
|
||||||
|
s.Log().Error("Failed to save security bulletin status", mlog.Err(err))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user