aboutsummaryrefslogtreecommitdiffstats
path: root/routers/web
diff options
context:
space:
mode:
authorBrecht Van Lommel <brecht@blender.org>2023-02-25 03:55:50 +0100
committerGitHub <noreply@github.com>2023-02-24 21:55:50 -0500
commit10cdcb9ea8077098921d72720f9f36fcfd950452 (patch)
treee966411cf1bbc62bf7059deaa9238c14c0a9a04d /routers/web
parent843f81113ebe71fd725210c5a382268333865cc7 (diff)
downloadgitea-10cdcb9ea8077098921d72720f9f36fcfd950452.tar.gz
gitea-10cdcb9ea8077098921d72720f9f36fcfd950452.zip
Add "Reviewed by you" filter for pull requests (#22927)
This includes pull requests that you approved, requested changes or commented on. Currently such pull requests are not visible in any of the filters on /pulls, while they may need further action like merging, or prodding the author or reviewers. Especially when working with a large team on a repository it's helpful to get a full overview of pull requests that may need your attention, without having to sift through the complete list.
Diffstat (limited to 'routers/web')
-rw-r--r--routers/web/repo/issue.go10
-rw-r--r--routers/web/user/home.go4
2 files changed, 13 insertions, 1 deletions
diff --git a/routers/web/repo/issue.go b/routers/web/repo/issue.go
index 05ba26a70c..745d6e70a0 100644
--- a/routers/web/repo/issue.go
+++ b/routers/web/repo/issue.go
@@ -138,7 +138,7 @@ func issues(ctx *context.Context, milestoneID, projectID int64, isPullOption uti
var err error
viewType := ctx.FormString("type")
sortType := ctx.FormString("sort")
- types := []string{"all", "your_repositories", "assigned", "created_by", "mentioned", "review_requested"}
+ types := []string{"all", "your_repositories", "assigned", "created_by", "mentioned", "review_requested", "reviewed_by"}
if !util.SliceContainsString(types, viewType, true) {
viewType = "all"
}
@@ -148,6 +148,7 @@ func issues(ctx *context.Context, milestoneID, projectID int64, isPullOption uti
posterID = ctx.FormInt64("poster")
mentionedID int64
reviewRequestedID int64
+ reviewedID int64
forceEmpty bool
)
@@ -161,6 +162,8 @@ func issues(ctx *context.Context, milestoneID, projectID int64, isPullOption uti
assigneeID = ctx.Doer.ID
case "review_requested":
reviewRequestedID = ctx.Doer.ID
+ case "reviewed_by":
+ reviewedID = ctx.Doer.ID
}
}
@@ -208,6 +211,7 @@ func issues(ctx *context.Context, milestoneID, projectID int64, isPullOption uti
MentionedID: mentionedID,
PosterID: posterID,
ReviewRequestedID: reviewRequestedID,
+ ReviewedID: reviewedID,
IsPull: isPullOption,
IssueIDs: issueIDs,
})
@@ -255,6 +259,7 @@ func issues(ctx *context.Context, milestoneID, projectID int64, isPullOption uti
PosterID: posterID,
MentionedID: mentionedID,
ReviewRequestedID: reviewRequestedID,
+ ReviewedID: reviewedID,
MilestoneIDs: mileIDs,
ProjectID: projectID,
IsClosed: util.OptionalBoolOf(isShowClosed),
@@ -2425,6 +2430,9 @@ func SearchIssues(ctx *context.Context) {
if ctx.FormBool("review_requested") {
issuesOpt.ReviewRequestedID = ctxUserID
}
+ if ctx.FormBool("reviewed") {
+ issuesOpt.ReviewedID = ctxUserID
+ }
if issues, err = issues_model.Issues(ctx, issuesOpt); err != nil {
ctx.Error(http.StatusInternalServerError, "Issues", err.Error())
diff --git a/routers/web/user/home.go b/routers/web/user/home.go
index 2593ab148c..a0a5dc3c4b 100644
--- a/routers/web/user/home.go
+++ b/routers/web/user/home.go
@@ -385,6 +385,8 @@ func buildIssueOverview(ctx *context.Context, unitType unit.Type) {
filterMode = issues_model.FilterModeMention
case "review_requested":
filterMode = issues_model.FilterModeReviewRequested
+ case "reviewed_by":
+ filterMode = issues_model.FilterModeReviewed
case "your_repositories":
fallthrough
default:
@@ -453,6 +455,8 @@ func buildIssueOverview(ctx *context.Context, unitType unit.Type) {
opts.MentionedID = ctx.Doer.ID
case issues_model.FilterModeReviewRequested:
opts.ReviewRequestedID = ctx.Doer.ID
+ case issues_model.FilterModeReviewed:
+ opts.ReviewedID = ctx.Doer.ID
}
// keyword holds the search term entered into the search field.