diff --git a/routers/web/repo/issue.go b/routers/web/repo/issue.go index a4f6f97a05..7ab9d62b69 100644 --- a/routers/web/repo/issue.go +++ b/routers/web/repo/issue.go @@ -2401,10 +2401,6 @@ func UpdateIssueMilestone(ctx *context.Context) { } if ctx.FormBool("htmx") { - renderMilestones(ctx) - if ctx.Written() { - return - } prepareHiddenCommentType(ctx) if ctx.Written() { return diff --git a/templates/htmx/milestone_sidebar.tmpl b/templates/htmx/milestone_sidebar.tmpl index 05bbd802cc..87eb5a7f42 100644 --- a/templates/htmx/milestone_sidebar.tmpl +++ b/templates/htmx/milestone_sidebar.tmpl @@ -1,4 +1,4 @@
{{template "repo/issue/view_content/comments" .}}
-{{template "repo/issue/view_content/sidebar/milestones" .}} +{{template "repo/issue/milestone/selected" .}} diff --git a/templates/repo/issue/milestone/selected.tmpl b/templates/repo/issue/milestone/selected.tmpl new file mode 100644 index 0000000000..c5ed4c81af --- /dev/null +++ b/templates/repo/issue/milestone/selected.tmpl @@ -0,0 +1,11 @@ +
+ {{ctx.Locale.Tr "repo.issues.new.no_milestone"}} +
+ {{if .Issue.Milestone}} + + {{svg "octicon-milestone" 18 "tw-mr-2"}} + {{.Issue.Milestone.Name}} + + {{end}} +
+
diff --git a/templates/repo/issue/view_content/sidebar/milestones.tmpl b/templates/repo/issue/view_content/sidebar/milestones.tmpl index 44d9419f9b..ffcd87e8fd 100644 --- a/templates/repo/issue/view_content/sidebar/milestones.tmpl +++ b/templates/repo/issue/view_content/sidebar/milestones.tmpl @@ -1,4 +1,4 @@ -
+
-
- {{ctx.Locale.Tr "repo.issues.new.no_milestone"}} - -
+ {{template "repo/issue/milestone/selected" .}}
diff --git a/tests/e2e/issue-sidebar.test.e2e.ts b/tests/e2e/issue-sidebar.test.e2e.ts index 9d2975b612..06cf1fb98f 100644 --- a/tests/e2e/issue-sidebar.test.e2e.ts +++ b/tests/e2e/issue-sidebar.test.e2e.ts @@ -221,7 +221,7 @@ test('Issue: Milestone', async ({page}, workerInfo) => { const response = await page.goto('/user2/repo1/issues/1'); expect(response?.status()).toBe(200); - const selectedMilestone = page.locator('.issue-content-right .select-milestone.list'); + const selectedMilestone = page.locator('.issue-content-right #selected-milestone'); const milestoneDropdown = page.locator('.issue-content-right .select-milestone.dropdown'); await expect(selectedMilestone).toContainText('No milestone');