diff options
author | wxiaoguang <wxiaoguang@gmail.com> | 2024-03-21 23:07:35 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-03-21 15:07:35 +0000 |
commit | cdb4d1a8db096d60dba04728924dab85def45b19 (patch) | |
tree | 58377e0202cd4186faad7bc7add82e1b11662b90 /routers/web/user | |
parent | 82979588f4d8699097451ebb70c56a4bdd090c52 (diff) | |
download | gitea-cdb4d1a8db096d60dba04728924dab85def45b19.tar.gz gitea-cdb4d1a8db096d60dba04728924dab85def45b19.zip |
Refactor StringsToInt64s (#29967)
And close #27176
Diffstat (limited to 'routers/web/user')
-rw-r--r-- | routers/web/user/home.go | 7 | ||||
-rw-r--r-- | routers/web/user/notification.go | 3 |
2 files changed, 3 insertions, 7 deletions
diff --git a/routers/web/user/home.go b/routers/web/user/home.go index 465de500a0..ff6c2a6c36 100644 --- a/routers/web/user/home.go +++ b/routers/web/user/home.go @@ -529,17 +529,14 @@ func buildIssueOverview(ctx *context.Context, unitType unit.Type) { // Get IDs for labels (a filter option for issues/pulls). // Required for IssuesOptions. - var labelIDs []int64 selectedLabels := ctx.FormString("labels") if len(selectedLabels) > 0 && selectedLabels != "0" { var err error - labelIDs, err = base.StringsToInt64s(strings.Split(selectedLabels, ",")) + opts.LabelIDs, err = base.StringsToInt64s(strings.Split(selectedLabels, ",")) if err != nil { - ctx.ServerError("StringsToInt64s", err) - return + ctx.Flash.Error(ctx.Tr("invalid_data", selectedLabels), true) } } - opts.LabelIDs = labelIDs // ------------------------------ // Get issues as defined by opts. diff --git a/routers/web/user/notification.go b/routers/web/user/notification.go index 28f9846d6b..ae0132e6e2 100644 --- a/routers/web/user/notification.go +++ b/routers/web/user/notification.go @@ -268,8 +268,7 @@ func NotificationSubscriptions(ctx *context.Context) { var err error labelIDs, err = base.StringsToInt64s(strings.Split(selectedLabels, ",")) if err != nil { - ctx.ServerError("StringsToInt64s", err) - return + ctx.Flash.Error(ctx.Tr("invalid_data", selectedLabels), true) } } |