From beb58292ae4d722356b16dfba8fdc04e34e61845 Mon Sep 17 00:00:00 2001 From: Amolith Date: Sat, 18 Oct 2025 11:55:27 -0600 Subject: [PATCH] feat(web/bugs): use styled spans for label events Display labels in bug timeline label change events with the bug-label CSS class and --label-color custom property instead of plain code tags, ensuring consistent visual styling across all label displays. Implements: bug-f4f7a02 Co-authored-by: Crush --- pkg/web/templates/bug.html | 4 ++-- pkg/web/webui_bugs.go | 12 ++++++------ 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/pkg/web/templates/bug.html b/pkg/web/templates/bug.html index aa59cdf39a83568bb3908874e98507252ada8204..5a015d3e989d87d5bacda4051bdc29c2b7061e31 100644 --- a/pkg/web/templates/bug.html +++ b/pkg/web/templates/bug.html @@ -72,12 +72,12 @@ {{if .AuthorAvatar}}{{end}}{{.Author}} {{if .AddedLabels}} added label{{if gt (len .AddedLabels) 1}}s{{end}} - {{range $i, $label := .AddedLabels}}{{if $i}}, {{end}}{{$label}}{{end}} + {{range $i, $label := .AddedLabels}}{{if $i}}, {{end}}{{$label.Name}}{{end}} {{end}} {{if and .AddedLabels .RemovedLabels}} and {{end}} {{if .RemovedLabels}} removed label{{if gt (len .RemovedLabels) 1}}s{{end}} - {{range $i, $label := .RemovedLabels}}{{if $i}}, {{end}}{{$label}}{{end}} + {{range $i, $label := .RemovedLabels}}{{if $i}}, {{end}}{{$label.Name}}{{end}} {{end}}

diff --git a/pkg/web/webui_bugs.go b/pkg/web/webui_bugs.go index 1e4fe6bd63e186d598e633b1d1c8c09dff593076..312c2ca1b57bc4ef53e14093b47fb0198ae27483 100644 --- a/pkg/web/webui_bugs.go +++ b/pkg/web/webui_bugs.go @@ -69,8 +69,8 @@ type TimelineItem struct { Message template.HTML Title string Status string - AddedLabels []string - RemovedLabels []string + AddedLabels []Label + RemovedLabels []Label } type Label struct { @@ -256,14 +256,14 @@ func buildTimelineItems(snap *bug.Snapshot) []TimelineItem { }) case *bug.LabelChangeTimelineItem: - added := make([]string, len(op.Added)) + added := make([]Label, len(op.Added)) for i, label := range op.Added { - added[i] = label.String() + added[i] = labelToWebLabel(label) } - removed := make([]string, len(op.Removed)) + removed := make([]Label, len(op.Removed)) for i, label := range op.Removed { - removed[i] = label.String() + removed[i] = labelToWebLabel(label) } items = append(items, TimelineItem{