From 7c0ac9173bc1fb02ab3c09d0693594b7d67bf190 Mon Sep 17 00:00:00 2001 From: Lunny Xiao Date: Sat, 21 Feb 2026 12:39:14 -0800 Subject: [PATCH] adjustment --- models/issues/comment.go | 6 +++--- services/projects/workflow_notifier.go | 6 +++++- .../repo/issue/view_content/comments.tmpl | 20 +++++++++---------- .../view_content/comments_authorlink.tmpl | 6 +++--- templates/repo/projects/workflows.tmpl | 2 +- .../components/projects/ProjectWorkflow.vue | 17 +++------------- 6 files changed, 25 insertions(+), 32 deletions(-) diff --git a/models/issues/comment.go b/models/issues/comment.go index 47d5bb8daf..9302ab3471 100644 --- a/models/issues/comment.go +++ b/models/issues/comment.go @@ -806,14 +806,14 @@ func (c *Comment) MetaSpecialDoerTr(locale translation.Locale) template.HTML { return locale.Tr("repo.issues.review.codeowners_rules") case SpecialDoerNameProjectWorkflow: if c.CommentMetaData.ProjectWorkflowID > 0 { - return htmlutil.HTMLFormat("%s", locale.Tr("repo.issues.project_workflow_action", + return locale.Tr("repo.issues.project_workflow_action", htmlutil.HTMLFormat("%s", locale.Tr(c.CommentMetaData.ProjectWorkflowEvent.LangKey())), htmlutil.HTMLFormat("%s", c.CommentMetaData.ProjectTitle), - )) + ) } return locale.Tr("repo.issues.project_workflow") } - return htmlutil.HTMLFormat("%s", c.CommentMetaData.SpecialDoerName) + return template.HTML(c.CommentMetaData.SpecialDoerName) } func (c *Comment) TimelineRequestedReviewTr(locale translation.Locale, createdStr template.HTML) template.HTML { diff --git a/services/projects/workflow_notifier.go b/services/projects/workflow_notifier.go index c99a7adaf9..a77fcd6940 100644 --- a/services/projects/workflow_notifier.go +++ b/services/projects/workflow_notifier.go @@ -348,8 +348,12 @@ func executeWorkflowActions(ctx context.Context, workflow *project_model.Workflo if err := workflow.LoadProject(ctx); err != nil { log.Error("LoadProject: %v", err) } + title := "" + if workflow.Project != nil { + title = workflow.Project.Title + } workflowCtx := issues_model.WithProjectWorkflowCommentMeta(ctx, issues_model.ProjectWorkflowCommentMeta{ - ProjectTitle: util.Iif(workflow.Project != nil, workflow.Project.Title, ""), + ProjectTitle: title, ProjectWorkflowID: workflow.ID, ProjectWorkflowEvent: workflow.WorkflowEvent, }) diff --git a/templates/repo/issue/view_content/comments.tmpl b/templates/repo/issue/view_content/comments.tmpl index 982c8373b2..4deaac4cbe 100644 --- a/templates/repo/issue/view_content/comments.tmpl +++ b/templates/repo/issue/view_content/comments.tmpl @@ -86,7 +86,7 @@ {{template "shared/user/avatarlink" dict "user" .Poster}} {{end}} - {{template "repo/issue/view_content/comments_authorlink" dict "ctxData" $ "comment" .}} + {{template "repo/issue/view_content/comments_authorlink" dict "comment" .}} {{if .Issue.IsPull}} {{ctx.Locale.Tr "repo.pulls.reopened_at" .EventTag $createdStr}} {{else}} @@ -101,7 +101,7 @@ {{template "shared/user/avatarlink" dict "user" .Poster}} {{end}} - {{template "repo/issue/view_content/comments_authorlink" dict "ctxData" $ "comment" .}} + {{template "repo/issue/view_content/comments_authorlink" dict "comment" .}} {{if .Issue.IsPull}} {{ctx.Locale.Tr "repo.pulls.closed_at" .EventTag $createdStr}} {{else}} @@ -116,7 +116,7 @@ {{template "shared/user/avatarlink" dict "user" .Poster}} {{end}} - {{template "repo/issue/view_content/comments_authorlink" dict "ctxData" $ "comment" .}} + {{template "repo/issue/view_content/comments_authorlink" dict "comment" .}} {{$link := printf "%s/commit/%s" $.Repository.Link ($.Issue.PullRequest.MergedCommitID|PathEscape)}} {{if eq $.Issue.PullRequest.Status 3}} {{ctx.Locale.Tr "repo.issues.comment_manually_pull_merged_at" (HTMLFormat `%[2]s` $link (ShortSha $.Issue.PullRequest.MergedCommitID)) (HTMLFormat "%[1]s" $.BaseTarget) $createdStr}} @@ -144,7 +144,7 @@ {{template "shared/user/avatarlink" dict "user" .Poster}} {{if eq .RefAction 3}}{{end}} - {{template "repo/issue/view_content/comments_authorlink" dict "ctxData" $ "comment" .}} + {{template "repo/issue/view_content/comments_authorlink" dict "comment" .}} {{ctx.Locale.Tr $refTr .EventTag $createdStr (.RefCommentLink ctx) $refFrom}} {{if eq .RefAction 3}}{{end}} @@ -158,7 +158,7 @@ {{svg "octicon-bookmark"}} {{template "shared/user/avatarlink" dict "user" .Poster}} - {{template "repo/issue/view_content/comments_authorlink" dict "ctxData" $ "comment" .}} + {{template "repo/issue/view_content/comments_authorlink" dict "comment" .}} {{ctx.Locale.Tr "repo.issues.commit_ref_at" .EventTag $createdStr}}
@@ -173,7 +173,7 @@ {{svg "octicon-tag"}} {{template "shared/user/avatarlink" dict "user" .Poster}} - {{template "repo/issue/view_content/comments_authorlink" dict "ctxData" $ "comment" .}} + {{template "repo/issue/view_content/comments_authorlink" dict "comment" .}} {{if and .AddedLabels (not .RemovedLabels)}} {{ctx.Locale.TrN (len .AddedLabels) "repo.issues.add_label" "repo.issues.add_labels" (ctx.RenderUtils.RenderLabels .AddedLabels $.RepoLink .Issue) $createdStr}} {{else if and (not .AddedLabels) .RemovedLabels}} @@ -376,7 +376,7 @@ {{if .Review}}{{svg (printf "octicon-%s" .Review.Type.Icon)}}{{end}} - {{template "repo/issue/view_content/comments_authorlink" dict "ctxData" $ "comment" .}} + {{template "repo/issue/view_content/comments_authorlink" dict "comment" .}} {{if eq $reviewType 1}} {{ctx.Locale.Tr "repo.issues.review.approve" $createdStr}} {{else if eq $reviewType 2}} @@ -488,7 +488,7 @@ {{template "shared/user/avatarlink" dict "user" .Poster}} {{end}} - {{template "repo/issue/view_content/comments_authorlink" dict "ctxData" $ "comment" .}} + {{template "repo/issue/view_content/comments_authorlink" dict "comment" .}} {{ctx.Locale.Tr "repo.pulls.change_target_branch_at" .OldRef .NewRef $createdStr}}
@@ -588,7 +588,7 @@ {{svg "octicon-project"}} {{template "shared/user/avatarlink" dict "user" .Poster}} - {{template "repo/issue/view_content/comments_authorlink" dict "ctxData" $ "comment" .}} + {{template "repo/issue/view_content/comments_authorlink" dict "comment" .}} {{$newProjectDisplay := .CommentMetaData.ProjectTitle}} {{if .Project}} {{$trKey := printf "projects.type-%d.display_name" .Project.Type}} @@ -663,7 +663,7 @@
{{svg "octicon-git-merge" 16}} - {{template "repo/issue/view_content/comments_authorlink" dict "ctxData" $ "comment" .}} + {{template "repo/issue/view_content/comments_authorlink" dict "comment" .}} {{if eq .Type 34}}{{ctx.Locale.Tr "repo.pulls.auto_merge_newly_scheduled_comment" $createdStr}} {{else}}{{ctx.Locale.Tr "repo.pulls.auto_merge_canceled_schedule_comment" $createdStr}}{{end}} diff --git a/templates/repo/issue/view_content/comments_authorlink.tmpl b/templates/repo/issue/view_content/comments_authorlink.tmpl index 26c223c5d2..0098f1e99c 100644 --- a/templates/repo/issue/view_content/comments_authorlink.tmpl +++ b/templates/repo/issue/view_content/comments_authorlink.tmpl @@ -1,10 +1,10 @@ {{if .comment.OriginalAuthor}} - {{svg (MigrationIcon .ctxData.Repository.GetOriginalURLHostname)}} + {{svg (MigrationIcon ctx.Repository.GetOriginalURLHostname)}} {{.comment.OriginalAuthor}} - {{if .ctxData.Repository.OriginalURL}} - ({{ctx.Locale.Tr "repo.migrated_from" .ctxData.Repository.OriginalURL .ctxData.Repository.GetOriginalURLHostname}}) + {{if ctx.Repository.OriginalURL}} + ({{ctx.Locale.Tr "repo.migrated_from" ctx.Repository.OriginalURL ctx.Repository.GetOriginalURLHostname}}) {{end}} {{else}} {{$specialDoerHtml := .comment.MetaSpecialDoerTr ctx.Locale}} diff --git a/templates/repo/projects/workflows.tmpl b/templates/repo/projects/workflows.tmpl index 86175bcb83..e9a09ee1ca 100644 --- a/templates/repo/projects/workflows.tmpl +++ b/templates/repo/projects/workflows.tmpl @@ -3,7 +3,7 @@ {{template "repo/header" .}} {{template "projects/workflows" .}} diff --git a/web_src/js/components/projects/ProjectWorkflow.vue b/web_src/js/components/projects/ProjectWorkflow.vue index 20089531a4..f3ef72e015 100644 --- a/web_src/js/components/projects/ProjectWorkflow.vue +++ b/web_src/js/components/projects/ProjectWorkflow.vue @@ -858,7 +858,7 @@ onUnmounted(() => {
-
+
{{ locale.anyLabel }} {
-
+
{{ locale.none }} {
-
+
{{ locale.none }} { margin: 0.125rem; } -.ui.labels { - display: flex; - flex-wrap: wrap; - gap: 0.5rem; - align-items: center; -} - -.ui.labels .ui.label { - margin: 0; -} - .text-muted { color: var(--color-text-light-2); }