From 5c236bd4c024dbe4a71516b10aa812893651983a Mon Sep 17 00:00:00 2001 From: wxiaoguang Date: Sun, 5 May 2024 21:09:41 +0800 Subject: [PATCH] Fix issue/PR title edit (#30858) 1. "enter" doesn't work (I think it is the last enter support for #14843) 2. if a branch name contains something like `&`, then the branch selector doesn't update --- templates/repo/issue/view_title.tmpl | 43 ++++---- tests/integration/issue_test.go | 2 +- tests/integration/pull_create_test.go | 2 +- web_src/css/repo.css | 75 +++++++------- web_src/js/features/common-global.js | 16 ++- web_src/js/features/comp/QuickSubmit.js | 13 +-- web_src/js/features/repo-issue.js | 129 +++++++++++------------- 7 files changed, 141 insertions(+), 139 deletions(-) diff --git a/templates/repo/issue/view_title.tmpl b/templates/repo/issue/view_title.tmpl index fccf8cca91..4415ad79f5 100644 --- a/templates/repo/issue/view_title.tmpl +++ b/templates/repo/issue/view_title.tmpl @@ -4,29 +4,36 @@ {{end}}
-
+ {{$canEditIssueTitle := and (or .HasIssuesOrPullsWritePermission .IsIssuePoster) (not .Repository.IsArchived)}} +

- {{RenderIssueTitle $.Context .Issue.Title ($.Repository.ComposeMetas ctx) | RenderCodeBlock}} #{{.Issue.Index}} - -
- -
+ {{RenderIssueTitle $.Context .Issue.Title ($.Repository.ComposeMetas ctx) | RenderCodeBlock}} + #{{.Issue.Index}}

- {{if and (or .HasIssuesOrPullsWritePermission .IsIssuePoster) (not .Repository.IsArchived)}} - + {{if $canEditIssueTitle}} + {{end}} {{if not .Issue.IsPull}} - {{ctx.Locale.Tr "repo.issues.new"}} + {{ctx.Locale.Tr "repo.issues.new"}} {{end}}
- {{if and (or .HasIssuesOrPullsWritePermission .IsIssuePoster) (not .Repository.IsArchived)}} -
- - -
- {{end}}
+ {{if $canEditIssueTitle}} +
+
+ +
+
+ + +
+
+ {{end}}
{{if .HasMerged}}
{{svg "octicon-git-merge" 16 "tw-mr-1"}} {{if eq .Issue.PullRequest.Status 3}}{{ctx.Locale.Tr "repo.pulls.manually_merged"}}{{else}}{{ctx.Locale.Tr "repo.pulls.merged"}}{{end}}
@@ -63,14 +70,14 @@ {{end}} {{else}} {{if .Issue.OriginalAuthor}} - {{.Issue.OriginalAuthor}} {{ctx.Locale.Tr "repo.pulls.title_desc" .NumCommits $headHref $baseHref}} + {{.Issue.OriginalAuthor}} {{ctx.Locale.Tr "repo.pulls.title_desc" .NumCommits $headHref $baseHref}} {{else}} - + {{.Issue.Poster.GetDisplayName}} {{ctx.Locale.Tr "repo.pulls.title_desc" .NumCommits $headHref $baseHref}} {{end}} - +