diff options
author | 6543 <6543@obermui.de> | 2020-04-30 06:15:39 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-04-30 01:15:39 -0300 |
commit | bfda0f38646f66dbae2767eed3097489c456ebf5 (patch) | |
tree | b3c915a6fb63215cd2c31c24bf4d7da332503565 /routers/repo | |
parent | cbf5dffaf29c1e871342c15478b33e9229a7f9d2 (diff) | |
download | gitea-bfda0f38646f66dbae2767eed3097489c456ebf5.tar.gz gitea-bfda0f38646f66dbae2767eed3097489c456ebf5.zip |
[API] ListIssues add filter for milestones (#10148)
* Refactor Issue Filter Func
* ListIssues add filter for milestones
* as per @lafriks
* documentation ...
Diffstat (limited to 'routers/repo')
-rw-r--r-- | routers/repo/issue.go | 25 |
1 files changed, 15 insertions, 10 deletions
diff --git a/routers/repo/issue.go b/routers/repo/issue.go index 01614851fe..6a713f9061 100644 --- a/routers/repo/issue.go +++ b/routers/repo/issue.go @@ -190,6 +190,11 @@ func issues(ctx *context.Context, milestoneID int64, isPullOption util.OptionalB } pager := context.NewPagination(total, setting.UI.IssuePagingNum, page, 5) + var mileIDs []int64 + if milestoneID > 0 { + mileIDs = []int64{milestoneID} + } + var issues []*models.Issue if forceEmpty { issues = []*models.Issue{} @@ -199,16 +204,16 @@ func issues(ctx *context.Context, milestoneID int64, isPullOption util.OptionalB Page: pager.Paginater.Current(), PageSize: setting.UI.IssuePagingNum, }, - RepoIDs: []int64{repo.ID}, - AssigneeID: assigneeID, - PosterID: posterID, - MentionedID: mentionedID, - MilestoneID: milestoneID, - IsClosed: util.OptionalBoolOf(isShowClosed), - IsPull: isPullOption, - LabelIDs: labelIDs, - SortType: sortType, - IssueIDs: issueIDs, + RepoIDs: []int64{repo.ID}, + AssigneeID: assigneeID, + PosterID: posterID, + MentionedID: mentionedID, + MilestoneIDs: mileIDs, + IsClosed: util.OptionalBoolOf(isShowClosed), + IsPull: isPullOption, + LabelIDs: labelIDs, + SortType: sortType, + IssueIDs: issueIDs, }) if err != nil { ctx.ServerError("Issues", err) |