From ccc9b928fe777e8d0bb3fe5f03a6a7aa97e5af2b Mon Sep 17 00:00:00 2001 From: wxiaoguang Date: Wed, 14 Oct 2026 20:07:31 +0800 Subject: [PATCH] refactor: issue comment context menu and buttons (#39771) 1. Support show "Quote reply" shortcut in help menu, fix the TODO 2. Help #36862 to reuse existing "issue/comment context menu" --- templates/repo/diff/comment_form.tmpl | 10 +- templates/repo/diff/comments.tmpl | 4 +- templates/repo/diff/new_review.tmpl | 17 ++- templates/repo/issue/view_content.tmpl | 2 +- .../repo/issue/view_content/comments.tmpl | 4 +- .../repo/issue/view_content/context_menu.tmpl | 57 ++++----- .../repo/issue/view_content/conversation.tmpl | 32 ++--- tests/e2e/pr-review.test.ts | 28 ++++- tests/integration/pull_diff_test.go | 9 +- web_src/css/review.css | 9 +- web_src/js/features/repo-diff.ts | 2 +- web_src/js/features/repo-issue-edit.test.ts | 16 +-- web_src/js/features/repo-issue-edit.ts | 40 +++--- web_src/js/features/repo-issue.ts | 115 ++++++++---------- web_src/js/features/repo-legacy.ts | 11 +- web_src/js/modules/shortcut.ts | 40 +++--- 16 files changed, 205 insertions(+), 191 deletions(-) diff --git a/templates/repo/diff/comment_form.tmpl b/templates/repo/diff/comment_form.tmpl index 08c3750d013..a8c209f033b 100644 --- a/templates/repo/diff/comment_form.tmpl +++ b/templates/repo/diff/comment_form.tmpl @@ -27,19 +27,19 @@ diff --git a/templates/repo/diff/comments.tmpl b/templates/repo/diff/comments.tmpl index 546a0229a78..449747f20b9 100644 --- a/templates/repo/diff/comments.tmpl +++ b/templates/repo/diff/comments.tmpl @@ -1,4 +1,4 @@ -{{range .comments}} +{{range $comment := .comments}} {{$createdStr:= DateUtils.TimeSince .CreatedUnix}}
@@ -53,7 +53,7 @@ {{if not $.root.Repository.IsArchived}} {{template "repo/issue/view_content/add_reaction" dict "ActionURL" (printf "%s/comments/%d/reactions" $.root.RepoLink .ID)}} {{end}} - {{template "repo/issue/view_content/context_menu" dict "item" . "delete" true "issue" false "diff" true "IsCommentPoster" (and $.root.IsSigned (eq $.root.SignedUserID .PosterID))}} + {{template "repo/issue/view_content/context_menu" dict "ConvContentType" "issue_comment" "ConvContentPage" "pr-files" "ConvContentItem" $comment}}
diff --git a/templates/repo/diff/new_review.tmpl b/templates/repo/diff/new_review.tmpl index b4be2ebae12..513d75cd872 100644 --- a/templates/repo/diff/new_review.tmpl +++ b/templates/repo/diff/new_review.tmpl @@ -1,8 +1,12 @@ -
-
{{end}} +
diff --git a/templates/repo/issue/view_content.tmpl b/templates/repo/issue/view_content.tmpl index dbf2712e100..a04f1cf5940 100644 --- a/templates/repo/issue/view_content.tmpl +++ b/templates/repo/issue/view_content.tmpl @@ -41,7 +41,7 @@ {{if not $.Repository.IsArchived}} {{template "repo/issue/view_content/add_reaction" dict "ActionURL" (printf "%s/issues/%d/reactions" $.RepoLink .Issue.Index)}} {{end}} - {{template "repo/issue/view_content/context_menu" dict "item" .Issue "delete" false "issue" true "diff" false "IsCommentPoster" $.IsIssuePoster}} + {{template "repo/issue/view_content/context_menu" dict "ConvContentType" "issue_main" "ConvContentItem" .Issue}}
diff --git a/templates/repo/issue/view_content/comments.tmpl b/templates/repo/issue/view_content/comments.tmpl index c55de5e9743..b82ebade71f 100644 --- a/templates/repo/issue/view_content/comments.tmpl +++ b/templates/repo/issue/view_content/comments.tmpl @@ -56,7 +56,7 @@ {{if not $.Repository.IsArchived}} {{template "repo/issue/view_content/add_reaction" dict "ActionURL" (printf "%s/comments/%d/reactions" $.RepoLink .ID)}} {{end}} - {{template "repo/issue/view_content/context_menu" dict "item" . "delete" true "issue" true "diff" false "IsCommentPoster" (and $.IsSigned (eq $.SignedUserID .PosterID))}} + {{template "repo/issue/view_content/context_menu" dict "ConvContentType" "issue_comment" "ConvContentItem" $comment}}
@@ -424,7 +424,7 @@ {{template "repo/issue/view_content/show_role" dict "ShowRole" .ShowRole}} {{if not $.Repository.IsArchived}} {{template "repo/issue/view_content/add_reaction" dict "ActionURL" (printf "%s/comments/%d/reactions" $.RepoLink .ID)}} - {{template "repo/issue/view_content/context_menu" dict "item" . "delete" false "issue" true "diff" false "IsCommentPoster" (and $.IsSigned (eq $.SignedUserID .PosterID))}} + {{template "repo/issue/view_content/context_menu" dict "ConvContentType" "pull_review" "ConvContentItem" $comment}} {{end}}
diff --git a/templates/repo/issue/view_content/context_menu.tmpl b/templates/repo/issue/view_content/context_menu.tmpl index 5a482d88bb0..59ee728c509 100644 --- a/templates/repo/issue/view_content/context_menu.tmpl +++ b/templates/repo/issue/view_content/context_menu.tmpl @@ -1,44 +1,45 @@ -