]> source.dussan.org Git - gitea.git/commitdiff
Fix pagination on `/notifications/watching` (#23564)
authorsilverwind <me@silverwind.io>
Tue, 21 Mar 2023 01:07:14 +0000 (02:07 +0100)
committerGitHub <noreply@github.com>
Tue, 21 Mar 2023 01:07:14 +0000 (21:07 -0400)
The `q` parameter was not rendered in pagination links because
`context.Pagination:AddParam` checks for existance of the parameter in
`ctx.Data` where it was absent. Added the parameter there to fix it.

routers/web/user/notification.go

index e12b41e649e6301b3fbcebda57c3b6c30aea9559..e0aa92879fcc421a2dd8f82ba12944e39593c765 100644 (file)
@@ -344,6 +344,9 @@ func NotificationWatching(ctx *context.Context) {
                page = 1
        }
 
+       keyword := ctx.FormTrim("q")
+       ctx.Data["Keyword"] = keyword
+
        var orderBy db.SearchOrderBy
        ctx.Data["SortType"] = ctx.FormString("sort")
        switch ctx.FormString("sort") {
@@ -378,7 +381,7 @@ func NotificationWatching(ctx *context.Context) {
                        Page:     page,
                },
                Actor:              ctx.Doer,
-               Keyword:            ctx.FormTrim("q"),
+               Keyword:            keyword,
                OrderBy:            orderBy,
                Private:            ctx.IsSigned,
                WatchedByID:        ctx.Doer.ID,