From e8d4b7a8b198eca3b0bd117efb422d7d7cac93fe Mon Sep 17 00:00:00 2001 From: Bartlomiej Komendarczuk Date: Tue, 16 Jul 2024 10:08:54 +0200 Subject: [PATCH 1/2] Added default sorting milestones by name (#27084) #26996 Added default sorting for milestones by name. Additional, name for sorting closestduedate and furthestduedate was broken, so I fixed it. --------- Co-authored-by: Lunny Xiao --- models/issues/milestone_list.go | 4 +++- options/locale/locale_en-US.ini | 1 + templates/repo/issue/milestone/filter_list.tmpl | 1 + templates/user/dashboard/milestones.tmpl | 1 + 4 files changed, 6 insertions(+), 1 deletion(-) diff --git a/models/issues/milestone_list.go b/models/issues/milestone_list.go index d1b3f0301b..955ab2356d 100644 --- a/models/issues/milestone_list.go +++ b/models/issues/milestone_list.go @@ -70,8 +70,10 @@ func (opts FindMilestoneOptions) ToOrders() string { return "num_issues DESC" case "id": return "id ASC" + case "name": + return "name DESC" default: - return "deadline_unix ASC, id ASC" + return "deadline_unix ASC, name ASC" } } diff --git a/options/locale/locale_en-US.ini b/options/locale/locale_en-US.ini index ef9e946c0a..95e8cd5b2e 100644 --- a/options/locale/locale_en-US.ini +++ b/options/locale/locale_en-US.ini @@ -1935,6 +1935,7 @@ milestones.edit_success = Milestone "%s" has been updated. milestones.deletion = Delete Milestone milestones.deletion_desc = Deleting a milestone removes it from all related issues. Continue? milestones.deletion_success = The milestone has been deleted. +milestones.filter_sort.name = Name milestones.filter_sort.earliest_due_data = Earliest due date milestones.filter_sort.latest_due_date = Latest due date milestones.filter_sort.least_complete = Least complete diff --git a/templates/repo/issue/milestone/filter_list.tmpl b/templates/repo/issue/milestone/filter_list.tmpl index 45f9866a16..430d3814ee 100644 --- a/templates/repo/issue/milestone/filter_list.tmpl +++ b/templates/repo/issue/milestone/filter_list.tmpl @@ -11,5 +11,6 @@ {{ctx.Locale.Tr "repo.milestones.filter_sort.most_complete"}} {{ctx.Locale.Tr "repo.milestones.filter_sort.most_issues"}} {{ctx.Locale.Tr "repo.milestones.filter_sort.least_issues"}} + {{ctx.Locale.Tr "repo.milestones.filter_sort.name"}} diff --git a/templates/user/dashboard/milestones.tmpl b/templates/user/dashboard/milestones.tmpl index 0f1e866a21..71ff8dba3f 100644 --- a/templates/user/dashboard/milestones.tmpl +++ b/templates/user/dashboard/milestones.tmpl @@ -65,6 +65,7 @@ {{ctx.Locale.Tr "repo.milestones.filter_sort.most_complete"}} {{ctx.Locale.Tr "repo.milestones.filter_sort.most_issues"}} {{ctx.Locale.Tr "repo.milestones.filter_sort.least_issues"}} + {{ctx.Locale.Tr "repo.milestones.filter_sort.name"}} From 3a7454df7a518f810fbeb34b9d784e7c29d173ff Mon Sep 17 00:00:00 2001 From: silverwind Date: Tue, 16 Jul 2024 12:14:27 +0200 Subject: [PATCH 2/2] Enable `no-jquery/no-class-state` (#31639) Just 4 validations and I specifically tested this by selecting/unselecting issue labels. Co-authored-by: Giteabot --- .eslintrc.yaml | 2 +- web_src/js/features/repo-legacy.ts | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.eslintrc.yaml b/.eslintrc.yaml index 47f4eaa2d2..65c897c913 100644 --- a/.eslintrc.yaml +++ b/.eslintrc.yaml @@ -512,7 +512,7 @@ rules: no-jquery/no-box-model: [2] no-jquery/no-browser: [2] no-jquery/no-camel-case: [2] - no-jquery/no-class-state: [0] + no-jquery/no-class-state: [2] no-jquery/no-class: [0] no-jquery/no-clone: [2] no-jquery/no-closest: [0] diff --git a/web_src/js/features/repo-legacy.ts b/web_src/js/features/repo-legacy.ts index b26803c76d..75b485cc98 100644 --- a/web_src/js/features/repo-legacy.ts +++ b/web_src/js/features/repo-legacy.ts @@ -125,7 +125,7 @@ export function initRepoCommentForm() { $listMenu.find('.item:not(.no-select)').on('click', function (e) { e.preventDefault(); - if ($(this).hasClass('ban-change')) { + if (this.classList.contains('ban-change')) { return false; } @@ -140,7 +140,7 @@ export function initRepoCommentForm() { if (this.getAttribute('data-scope') !== scope) { return true; } - if (this !== clickedItem && !$(this).hasClass('checked')) { + if (this !== clickedItem && !this.classList.contains('checked')) { return true; } } else if (this !== clickedItem) { @@ -148,7 +148,7 @@ export function initRepoCommentForm() { return true; } - if ($(this).hasClass('checked')) { + if (this.classList.contains('checked')) { $(this).removeClass('checked'); $(this).find('.octicon-check').addClass('tw-invisible'); if (hasUpdateAction) { @@ -187,7 +187,7 @@ export function initRepoCommentForm() { const listIds = []; $(this).parent().find('.item').each(function () { - if ($(this).hasClass('checked')) { + if (this.classList.contains('checked')) { listIds.push($(this).data('id')); $($(this).data('id-selector')).removeClass('tw-hidden'); } else {