From c401cda108b6ade02d4bf134736e38dbd2ad3cf5 Mon Sep 17 00:00:00 2001 From: Tyrone Yeh Date: Mon, 9 Feb 2026 05:00:18 +0800 Subject: [PATCH] Fix assignee sidebar links and empty placeholder after #32465 refactor (#36559) Follow-up to #32465: Fix the assignee sidebar after the selector refactor. Co-authored-by: wxiaoguang --- templates/repo/issue/sidebar/assignee_list.tmpl | 8 +++++--- templates/repo/issue/sidebar/label_list.tmpl | 7 ++++--- templates/repo/issue/sidebar/label_list_item.tmpl | 3 ++- web_src/js/features/repo-issue-sidebar.md | 10 ++++++++++ 4 files changed, 21 insertions(+), 7 deletions(-) diff --git a/templates/repo/issue/sidebar/assignee_list.tmpl b/templates/repo/issue/sidebar/assignee_list.tmpl index 1d2279a45d..f66a38d182 100644 --- a/templates/repo/issue/sidebar/assignee_list.tmpl +++ b/templates/repo/issue/sidebar/assignee_list.tmpl @@ -1,5 +1,7 @@ {{$pageMeta := .}} {{$data := .AssigneesData}} +{{$listBaseLink := print $pageMeta.RepoLink (Iif $pageMeta.IsPullRequest "/pulls" "/issues")}} +{{/* TODO: it seems that the code keeps checking $pageMeta.Issue and assumes that it might not exist, need to figure out why */}} {{$issueAssignees := NIL}}{{if $pageMeta.Issue}}{{$issueAssignees = $pageMeta.Issue.Assignees}}{{end}}
{{ctx.Locale.Tr "repo.issues.new.clear_assignees"}}
{{range $data.CandidateAssignees}} - + {{svg "octicon-check"}} {{ctx.AvatarUtils.Avatar . 20}} {{template "repo/search_name" .}} @@ -30,8 +32,8 @@ diff --git a/templates/repo/issue/sidebar/label_list.tmpl b/templates/repo/issue/sidebar/label_list.tmpl index 15c8760d1a..d30196326b 100644 --- a/templates/repo/issue/sidebar/label_list.tmpl +++ b/templates/repo/issue/sidebar/label_list.tmpl @@ -1,5 +1,6 @@ {{$pageMeta := .}} {{$data := .LabelsData}} +{{$listBaseLink := print $pageMeta.RepoLink (Iif $pageMeta.IsPullRequest "/pulls" "/issues")}}
@@ -26,7 +27,7 @@
{{end}} {{$previousExclusiveScope = $exclusiveScope}} - {{template "repo/issue/sidebar/label_list_item" dict "Label" .}} + {{template "repo/issue/sidebar/label_list_item" dict "Label" . "LabelLink" (print $listBaseLink "?labels=" .ID)}} {{end}} {{if and $data.RepoLabels $data.OrgLabels}}
{{end}} {{$previousExclusiveScope = "_no_scope"}} @@ -36,7 +37,7 @@
{{end}} {{$previousExclusiveScope = $exclusiveScope}} - {{template "repo/issue/sidebar/label_list_item" dict "Label" .}} + {{template "repo/issue/sidebar/label_list_item" dict "Label" . "LabelLink" (print $listBaseLink "?labels=" .ID)}} {{end}}
{{end}} @@ -47,7 +48,7 @@ {{ctx.Locale.Tr "repo.issues.new.no_label"}} {{range $data.AllLabels}} {{if .IsChecked}} - + {{- ctx.RenderUtils.RenderLabel . -}} {{end}} diff --git a/templates/repo/issue/sidebar/label_list_item.tmpl b/templates/repo/issue/sidebar/label_list_item.tmpl index 5c6808d95b..0c32d99bf9 100644 --- a/templates/repo/issue/sidebar/label_list_item.tmpl +++ b/templates/repo/issue/sidebar/label_list_item.tmpl @@ -1,5 +1,6 @@ {{$label := .Label}} - {{svg (Iif $label.ExclusiveScope "octicon-dot-fill" "octicon-check")}} diff --git a/web_src/js/features/repo-issue-sidebar.md b/web_src/js/features/repo-issue-sidebar.md index e1ce0927e1..d732bc6f54 100644 --- a/web_src/js/features/repo-issue-sidebar.md +++ b/web_src/js/features/repo-issue-sidebar.md @@ -23,6 +23,16 @@ When the selected items change, the `combo-value` input will be updated. If there is `data-update-url`, it also calls backend to attach/detach the changed items. Also, the changed items will be synchronized to the `ui list` items. +The menu items must have correct `href`, otherwise the links of synchronized (cloned) items would be wrong. + +Synchronization logic: +* On page load: + * If the dropdown menu contains checked items, there will be no synchronization. + In this case, it's assumed that the dropdown menu is already in sync with the list. + * If the dropdown menu doesn't contain checked items, it will use dropdown's value to mark the selected items as checked. + And the selected (checked) items will be synchronized to the list. +* On dropdown selection change: + * The selected items will be synchronized to the list after the dropdown is hidden The items with the same data-scope only allow one selected at a time.