From 6d2c29ae85ba0d99a68fd6f801acc4ac56e604d3 Mon Sep 17 00:00:00 2001 From: TimedIn Date: Tue, 8 Oct 2024 10:39:52 +0200 Subject: [PATCH 1/2] feat: "assign to me" button on PRs and issues includes: Tests for assignees on issues Move assignees selector of new Issue to assignees.tmpl (cherry picked from commit 2feb3d03d73a89c0d52a174c92915ca3930f08a7) --- options/locale/locale_en-US.ini | 1 + services/forms/repo_form.go | 2 +- templates/repo/issue/new_form.tmpl | 37 +------- .../repo/issue/view_content/sidebar.tmpl | 2 +- .../issue/view_content/sidebar/assignees.tmpl | 37 +++++--- tests/e2e/issue-sidebar.test.e2e.js | 85 +++++++++++++++++++ web_src/js/features/repo-issue.js | 54 ++++++++++++ web_src/js/features/repo-legacy.js | 22 +---- 8 files changed, 172 insertions(+), 68 deletions(-) diff --git a/options/locale/locale_en-US.ini b/options/locale/locale_en-US.ini index d6b0fb3066..6e4b81e004 100644 --- a/options/locale/locale_en-US.ini +++ b/options/locale/locale_en-US.ini @@ -1507,6 +1507,7 @@ issues.new.closed_milestone = Closed milestones issues.new.assignees = Assignees issues.new.clear_assignees = Clear assignees issues.new.no_assignees = No assignees +issues.new.assign_to_me = Assign to me issues.new.no_reviewers = No reviewers issues.edit.already_changed = Unable to save changes to the issue. It appears the content has already been changed by another user. Please refresh the page and try editing again to avoid overwriting their changes issues.choose.get_started = Get started diff --git a/services/forms/repo_form.go b/services/forms/repo_form.go index c3d9c3edc9..654106c47a 100644 --- a/services/forms/repo_form.go +++ b/services/forms/repo_form.go @@ -317,7 +317,7 @@ type WebhookForm struct { type CreateIssueForm struct { Title string `binding:"Required;MaxSize(255)"` LabelIDs string `form:"label_ids"` - AssigneeIDs string `form:"assignee_ids"` + AssigneeIDs string `form:"assignee_id"` Ref string `form:"ref"` MilestoneID int64 ProjectID int64 diff --git a/templates/repo/issue/new_form.tmpl b/templates/repo/issue/new_form.tmpl index fe10c1f9b9..c2cf4ee7a7 100644 --- a/templates/repo/issue/new_form.tmpl +++ b/templates/repo/issue/new_form.tmpl @@ -140,42 +140,7 @@ {{end}}
- - -
- - {{ctx.Locale.Tr "repo.issues.new.no_assignees"}} - - -
+ {{template "repo/issue/view_content/sidebar/assignees" dict "isExistingIssue" false "." .}} {{if and .PageIsComparePull (not (eq .HeadRepo.FullName .BaseCompareRepo.FullName)) .CanWriteToHeadRepo}}
diff --git a/templates/repo/issue/view_content/sidebar.tmpl b/templates/repo/issue/view_content/sidebar.tmpl index ba15539841..623023bd51 100644 --- a/templates/repo/issue/view_content/sidebar.tmpl +++ b/templates/repo/issue/view_content/sidebar.tmpl @@ -17,7 +17,7 @@ {{template "repo/issue/view_content/sidebar/projects" .}}
- {{template "repo/issue/view_content/sidebar/assignees" .}} + {{template "repo/issue/view_content/sidebar/assignees" dict "isExistingIssue" true "." .}}
{{if .Participants}} diff --git a/templates/repo/issue/view_content/sidebar/assignees.tmpl b/templates/repo/issue/view_content/sidebar/assignees.tmpl index e51bda95de..8e5043c076 100644 --- a/templates/repo/issue/view_content/sidebar/assignees.tmpl +++ b/templates/repo/issue/view_content/sidebar/assignees.tmpl @@ -1,12 +1,12 @@ -