From dac46b65f30793927d7016f0cf0cdfa0437a6858 Mon Sep 17 00:00:00 2001 From: Parnic Date: Sun, 31 Jul 2022 20:01:48 -0500 Subject: [PATCH 01/10] Add issue filter for Author This adds a new filter option on the issues and pulls pages to filter by the author/poster/creator of the issue or PR. Fixes #9408 --- options/locale/locale_en-US.ini | 2 + routers/web/repo/issue.go | 6 ++- templates/repo/issue/list.tmpl | 54 ++++++++++++++-------- templates/repo/issue/milestone_issues.tmpl | 44 ++++++++++++------ templates/repo/issue/openclose.tmpl | 4 +- templates/shared/issuelist.tmpl | 2 +- 6 files changed, 75 insertions(+), 37 deletions(-) diff --git a/options/locale/locale_en-US.ini b/options/locale/locale_en-US.ini index aad10ce87b1b2..5855fba859072 100644 --- a/options/locale/locale_en-US.ini +++ b/options/locale/locale_en-US.ini @@ -1267,6 +1267,8 @@ issues.filter_milestone = Milestone issues.filter_milestone_no_select = All milestones issues.filter_assignee = Assignee issues.filter_assginee_no_select = All assignees +issues.filter_poster = Author +issues.filter_poster_no_select = All authors issues.filter_type = Type issues.filter_type.all_issues = All issues issues.filter_type.assigned_to_you = Assigned to you diff --git a/routers/web/repo/issue.go b/routers/web/repo/issue.go index e6f9529e31e81..03ea29395dfb0 100644 --- a/routers/web/repo/issue.go +++ b/routers/web/repo/issue.go @@ -133,7 +133,7 @@ func issues(ctx *context.Context, milestoneID, projectID int64, isPullOption uti var ( assigneeID = ctx.FormInt64("assignee") - posterID int64 + posterID = ctx.FormInt64("poster") mentionedID int64 reviewRequestedID int64 forceEmpty bool @@ -291,6 +291,8 @@ func issues(ctx *context.Context, milestoneID, projectID int64, isPullOption uti return } + ctx.Data["Posters"] = ctx.Data["Assignees"] + handleTeamMentions(ctx) if ctx.Written() { return @@ -364,6 +366,7 @@ func issues(ctx *context.Context, milestoneID, projectID int64, isPullOption uti ctx.Data["SortType"] = sortType ctx.Data["MilestoneID"] = milestoneID ctx.Data["AssigneeID"] = assigneeID + ctx.Data["PosterID"] = posterID ctx.Data["IsShowClosed"] = isShowClosed ctx.Data["Keyword"] = keyword if isShowClosed { @@ -379,6 +382,7 @@ func issues(ctx *context.Context, milestoneID, projectID int64, isPullOption uti pager.AddParam(ctx, "labels", "SelectLabels") pager.AddParam(ctx, "milestone", "MilestoneID") pager.AddParam(ctx, "assignee", "AssigneeID") + pager.AddParam(ctx, "poster", "PosterID") ctx.Data["Page"] = pager } diff --git a/templates/repo/issue/list.tmpl b/templates/repo/issue/list.tmpl index 2a53239f1c6f7..2abfcc53664b2 100644 --- a/templates/repo/issue/list.tmpl +++ b/templates/repo/issue/list.tmpl @@ -46,9 +46,9 @@ @@ -60,9 +60,25 @@ {{svg "octicon-triangle-down" 14 "dropdown icon"}} + + + + @@ -74,9 +90,9 @@ {{svg "octicon-triangle-down" 14 "dropdown icon"}} @@ -109,14 +125,14 @@ {{svg "octicon-triangle-down" 14 "dropdown icon"}} diff --git a/templates/repo/issue/milestone_issues.tmpl b/templates/repo/issue/milestone_issues.tmpl index 484d0a8110663..5f8498704937a 100644 --- a/templates/repo/issue/milestone_issues.tmpl +++ b/templates/repo/issue/milestone_issues.tmpl @@ -52,9 +52,25 @@ + + + + @@ -68,7 +84,7 @@ {{end}} @@ -100,12 +116,12 @@ {{svg "octicon-triangle-down" 14 "dropdown icon"}} diff --git a/templates/repo/issue/openclose.tmpl b/templates/repo/issue/openclose.tmpl index 9242d0c5ca684..ccfb40684c3f7 100644 --- a/templates/repo/issue/openclose.tmpl +++ b/templates/repo/issue/openclose.tmpl @@ -1,5 +1,5 @@ From eab669dcf333777c61c725cf1060adb24054cc85 Mon Sep 17 00:00:00 2001 From: Parnic Date: Sun, 31 Jul 2022 20:44:40 -0500 Subject: [PATCH 02/10] Fix "all authors" button --- templates/repo/issue/list.tmpl | 2 +- templates/repo/issue/milestone_issues.tmpl | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/templates/repo/issue/list.tmpl b/templates/repo/issue/list.tmpl index 2abfcc53664b2..8e8c256c59199 100644 --- a/templates/repo/issue/list.tmpl +++ b/templates/repo/issue/list.tmpl @@ -74,7 +74,7 @@ {{svg "octicon-triangle-down" 14 "dropdown icon"}}