mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2025-08-26 18:20:57 +00:00
[GITEA] Only pass selected repository IDs to pagination
- Backport of https://codeberg.org/forgejo/forgejo/pulls/1848
- `ReposParam` is passed to the pagination as value for the `repos`
query. It should paginate to other pages with only the selected
repositories, which was currently not the case, but was already the case
for the links in the selectable items.
- Fix the wrong value being passed for issues/pulls lists.
- Fix the formatting of repository query value for milestones lists.
- Added integration testing.
- Resolves https://codeberg.org/forgejo/forgejo/issues/1836
(cherry picked from commit c648e5ab3a
)
This commit is contained in:
parent
272d0a4c20
commit
2552bb7b6e
2 changed files with 100 additions and 2 deletions
|
@ -315,9 +315,18 @@ func Milestones(ctx *context.Context) {
|
|||
ctx.Data["RepoIDs"] = repoIDs
|
||||
ctx.Data["IsShowClosed"] = isShowClosed
|
||||
|
||||
// Convert []int64 to string
|
||||
reposParam, err := json.Marshal(repoIDs)
|
||||
if err != nil {
|
||||
ctx.ServerError("json.Marshal", err)
|
||||
return
|
||||
}
|
||||
|
||||
ctx.Data["ReposParam"] = string(reposParam)
|
||||
|
||||
pager := context.NewPagination(pagerCount, setting.UI.IssuePagingNum, page, 5)
|
||||
pager.AddParam(ctx, "q", "Keyword")
|
||||
pager.AddParam(ctx, "repos", "RepoIDs")
|
||||
pager.AddParam(ctx, "repos", "ReposParam")
|
||||
pager.AddParam(ctx, "sort", "SortType")
|
||||
pager.AddParam(ctx, "state", "State")
|
||||
ctx.Data["Page"] = pager
|
||||
|
@ -690,7 +699,11 @@ func buildIssueOverview(ctx *context.Context, unitType unit.Type) {
|
|||
}
|
||||
|
||||
// Convert []int64 to string
|
||||
reposParam, _ := json.Marshal(opts.RepoIDs)
|
||||
reposParam, err := json.Marshal(selectedRepoIDs)
|
||||
if err != nil {
|
||||
ctx.ServerError("json.Marshal", err)
|
||||
return
|
||||
}
|
||||
|
||||
ctx.Data["ReposParam"] = string(reposParam)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue