mirror of
https://github.com/mattermost/mattermost.git
synced 2026-05-28 04:35:04 -04:00
[GH-28396] Fixed errcheck issues in server/channels/api4/ip_filtering.go (#28441)
* Fixed errcheck issues in server/channels/api4/ip_filtering.go * Added separate go routine to SendIPFiltersChangedEmail and removed redundant return * Added import for mlog * Changed from returning error to logging it --------- Co-authored-by: Ben Schumacher <ben.schumacher@mattermost.com>
This commit is contained in:
parent
7af408679e
commit
b8b3f9b012
2 changed files with 9 additions and 3 deletions
|
|
@ -82,7 +82,6 @@ issues:
|
|||
channels/api4/handlers_test.go|\
|
||||
channels/api4/import_test.go|\
|
||||
channels/api4/integration_action_test.go|\
|
||||
channels/api4/ip_filtering.go|\
|
||||
channels/api4/ip_filtering_test.go|\
|
||||
channels/api4/job_test.go|\
|
||||
channels/api4/license.go|\
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@ import (
|
|||
"net/http"
|
||||
|
||||
"github.com/mattermost/mattermost/server/public/model"
|
||||
"github.com/mattermost/mattermost/server/public/shared/mlog"
|
||||
"github.com/mattermost/mattermost/server/v8/channels/app"
|
||||
"github.com/mattermost/mattermost/server/v8/channels/audit"
|
||||
"github.com/mattermost/mattermost/server/v8/einterfaces"
|
||||
|
|
@ -81,7 +82,11 @@ func applyIPFilters(c *Context, w http.ResponseWriter, r *http.Request) {
|
|||
|
||||
auditRec.Success()
|
||||
|
||||
go c.App.SendIPFiltersChangedEmail(c.AppContext, c.AppContext.Session().UserId)
|
||||
go func() {
|
||||
if err := c.App.SendIPFiltersChangedEmail(c.AppContext, c.AppContext.Session().UserId); err != nil {
|
||||
c.Logger.Warn("Failed to send IP filters changed email", mlog.Err(err))
|
||||
}
|
||||
}()
|
||||
|
||||
if err := json.NewEncoder(w).Encode(updatedAllowedRanges); err != nil {
|
||||
c.Err = model.NewAppError("getIPFilters", "api.context.ip_filtering.get_ip_filters.app_error", nil, "", http.StatusInternalServerError).Wrap(err)
|
||||
|
|
@ -106,5 +111,7 @@ func myIP(c *Context, w http.ResponseWriter, r *http.Request) {
|
|||
return
|
||||
}
|
||||
|
||||
w.Write(json)
|
||||
if _, err := w.Write(json); err != nil {
|
||||
c.Logger.Warn("Error while writing response", mlog.Err(err))
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue