mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2025-08-01 17:38:33 +00:00
Add name filter to API for GetMilestoneList (#12336)
Adds a name filter to the API for GetMilestoneList Includes a small refactor: merge GetMilestones and GetMilestonesByRepoID Close #12260 Needed for https://gitea.com/gitea/go-sdk/issues/383 and https://gitea.com/gitea/tea/pulls/149
This commit is contained in:
parent
78cbd0ca72
commit
8bdc9795d8
8 changed files with 115 additions and 36 deletions
|
@ -13,6 +13,7 @@ import (
|
|||
"code.gitea.io/gitea/modules/context"
|
||||
"code.gitea.io/gitea/modules/markup/markdown"
|
||||
"code.gitea.io/gitea/modules/setting"
|
||||
"code.gitea.io/gitea/modules/structs"
|
||||
"code.gitea.io/gitea/modules/timeutil"
|
||||
"code.gitea.io/gitea/modules/util"
|
||||
|
||||
|
@ -47,13 +48,24 @@ func Milestones(ctx *context.Context) {
|
|||
}
|
||||
|
||||
var total int
|
||||
var state structs.StateType
|
||||
if !isShowClosed {
|
||||
total = int(stats.OpenCount)
|
||||
state = structs.StateOpen
|
||||
} else {
|
||||
total = int(stats.ClosedCount)
|
||||
state = structs.StateClosed
|
||||
}
|
||||
|
||||
miles, err := models.GetMilestones(ctx.Repo.Repository.ID, page, isShowClosed, sortType)
|
||||
miles, err := models.GetMilestones(models.GetMilestonesOption{
|
||||
ListOptions: models.ListOptions{
|
||||
Page: page,
|
||||
PageSize: setting.UI.IssuePagingNum,
|
||||
},
|
||||
RepoID: ctx.Repo.Repository.ID,
|
||||
State: state,
|
||||
SortType: sortType,
|
||||
})
|
||||
if err != nil {
|
||||
ctx.ServerError("GetMilestones", err)
|
||||
return
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue