summaryrefslogtreecommitdiffstats
path: root/routers/repo/issue.go
diff options
context:
space:
mode:
authorJimmy Praet <jimmy.praet@telenet.be>2021-01-17 17:34:19 +0100
committerGitHub <noreply@github.com>2021-01-17 17:34:19 +0100
commitacb1ceb1f426e87e7f821c01ab5b60dad7abc03d (patch)
treedda60238b70b45f7d1bb2f815862c67e82feb048 /routers/repo/issue.go
parent872d3088920f8da2070f497f40d89d35fff9679f (diff)
downloadgitea-acb1ceb1f426e87e7f821c01ab5b60dad7abc03d.tar.gz
gitea-acb1ceb1f426e87e7f821c01ab5b60dad7abc03d.zip
Add review requested filter on pull request overview (#13701)
* Add review requested filter on pull request overview #13682 fix formatting * add review_requested filter to /repos/issues/search API endpoint * only Approve and Reject status should supersede Request status * add support for team reviews * refactor: remove duplication of issue filtering conditions
Diffstat (limited to 'routers/repo/issue.go')
-rw-r--r--routers/repo/issue.go53
1 files changed, 29 insertions, 24 deletions
diff --git a/routers/repo/issue.go b/routers/repo/issue.go
index 478baf8d86..7b4044ac7b 100644
--- a/routers/repo/issue.go
+++ b/routers/repo/issue.go
@@ -113,16 +113,17 @@ func issues(ctx *context.Context, milestoneID, projectID int64, isPullOption uti
var err error
viewType := ctx.Query("type")
sortType := ctx.Query("sort")
- types := []string{"all", "your_repositories", "assigned", "created_by", "mentioned"}
+ types := []string{"all", "your_repositories", "assigned", "created_by", "mentioned", "review_requested"}
if !util.IsStringInSlice(viewType, types, true) {
viewType = "all"
}
var (
- assigneeID = ctx.QueryInt64("assignee")
- posterID int64
- mentionedID int64
- forceEmpty bool
+ assigneeID = ctx.QueryInt64("assignee")
+ posterID int64
+ mentionedID int64
+ reviewRequestedID int64
+ forceEmpty bool
)
if ctx.IsSigned {
@@ -133,6 +134,8 @@ func issues(ctx *context.Context, milestoneID, projectID int64, isPullOption uti
mentionedID = ctx.User.ID
case "assigned":
assigneeID = ctx.User.ID
+ case "review_requested":
+ reviewRequestedID = ctx.User.ID
}
}
@@ -169,14 +172,15 @@ func issues(ctx *context.Context, milestoneID, projectID int64, isPullOption uti
issueStats = &models.IssueStats{}
} else {
issueStats, err = models.GetIssueStats(&models.IssueStatsOptions{
- RepoID: repo.ID,
- Labels: selectLabels,
- MilestoneID: milestoneID,
- AssigneeID: assigneeID,
- MentionedID: mentionedID,
- PosterID: posterID,
- IsPull: isPullOption,
- IssueIDs: issueIDs,
+ RepoID: repo.ID,
+ Labels: selectLabels,
+ MilestoneID: milestoneID,
+ AssigneeID: assigneeID,
+ MentionedID: mentionedID,
+ PosterID: posterID,
+ ReviewRequestedID: reviewRequestedID,
+ IsPull: isPullOption,
+ IssueIDs: issueIDs,
})
if err != nil {
ctx.ServerError("GetIssueStats", err)
@@ -217,17 +221,18 @@ func issues(ctx *context.Context, milestoneID, projectID int64, isPullOption uti
Page: pager.Paginater.Current(),
PageSize: setting.UI.IssuePagingNum,
},
- RepoIDs: []int64{repo.ID},
- AssigneeID: assigneeID,
- PosterID: posterID,
- MentionedID: mentionedID,
- MilestoneIDs: mileIDs,
- ProjectID: projectID,
- IsClosed: util.OptionalBoolOf(isShowClosed),
- IsPull: isPullOption,
- LabelIDs: labelIDs,
- SortType: sortType,
- IssueIDs: issueIDs,
+ RepoIDs: []int64{repo.ID},
+ AssigneeID: assigneeID,
+ PosterID: posterID,
+ MentionedID: mentionedID,
+ ReviewRequestedID: reviewRequestedID,
+ MilestoneIDs: mileIDs,
+ ProjectID: projectID,
+ IsClosed: util.OptionalBoolOf(isShowClosed),
+ IsPull: isPullOption,
+ LabelIDs: labelIDs,
+ SortType: sortType,
+ IssueIDs: issueIDs,
})
if err != nil {
ctx.ServerError("Issues", err)