]> source.dussan.org Git - gitea.git/commitdiff
Fix pagination on `/notifications/watching` (#23564) (#23603)
authorGiteabot <teabot@gitea.io>
Tue, 21 Mar 2023 20:10:47 +0000 (16:10 -0400)
committerGitHub <noreply@github.com>
Tue, 21 Mar 2023 20:10:47 +0000 (16:10 -0400)
Backport #23564 by @silverwind

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.

Co-authored-by: silverwind <me@silverwind.io>
routers/web/user/notification.go

index e96b3dd27a95e96b44cfa755e3dcb60de5db948f..2d6cd08bbf502ec1b37f3c21beee17183b9c834d 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,