From ea00388acbafc0d0d7482b798098d036b918c583 Mon Sep 17 00:00:00 2001 From: yp05327 <576951401@qq.com> Date: Thu, 10 Aug 2023 07:39:40 +0000 Subject: [PATCH 1/4] fix --- templates/repo/diff/compare.tmpl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/repo/diff/compare.tmpl b/templates/repo/diff/compare.tmpl index 3bb7c2e81f89f..31069765bb633 100644 --- a/templates/repo/diff/compare.tmpl +++ b/templates/repo/diff/compare.tmpl @@ -177,7 +177,7 @@ {{if .IsNothingToCompare}} - {{if and $.IsSigned $.AllowEmptyPr (not .Repository.IsArchived)}} + {{if and .PageIsComparePull $.IsSigned $.AllowEmptyPr (not .Repository.IsArchived)}}
{{.locale.Tr "repo.pulls.nothing_to_compare_and_allow_empty_pr"}}
From 5b3abd642a422e5ed4f259dae1d8fa78f520962f Mon Sep 17 00:00:00 2001 From: yp05327 <576951401@qq.com> Date: Fri, 18 Aug 2023 00:31:03 +0000 Subject: [PATCH 2/4] improve --- templates/repo/diff/compare.tmpl | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/templates/repo/diff/compare.tmpl b/templates/repo/diff/compare.tmpl index 31069765bb633..a63d4801d194f 100644 --- a/templates/repo/diff/compare.tmpl +++ b/templates/repo/diff/compare.tmpl @@ -176,8 +176,8 @@
- {{if .IsNothingToCompare}} - {{if and .PageIsComparePull $.IsSigned $.AllowEmptyPr (not .Repository.IsArchived)}} + {{if and .PageIsComparePull .IsNothingToCompare}} + {{if and $.IsSigned $.AllowEmptyPr (not .Repository.IsArchived)}}
{{.locale.Tr "repo.pulls.nothing_to_compare_and_allow_empty_pr"}}
@@ -229,7 +229,7 @@ {{end}} {{$showDiffBox = true}} {{end}} - {{else}} + {{else if not .IsNothingToCompare}} {{$showDiffBox = true}} {{end}}
From 7f93d789393aa14cda09e37b3cec52a3d7ce543a Mon Sep 17 00:00:00 2001 From: yp05327 <576951401@qq.com> Date: Mon, 28 Aug 2023 05:03:46 +0000 Subject: [PATCH 3/4] add comment --- options/locale/locale_en-US.ini | 1 + templates/repo/diff/compare.tmpl | 8 +++++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/options/locale/locale_en-US.ini b/options/locale/locale_en-US.ini index 31d47ad6af202..1ef36030d93d8 100644 --- a/options/locale/locale_en-US.ini +++ b/options/locale/locale_en-US.ini @@ -1692,6 +1692,7 @@ pulls.select_commit_hold_shift_for_range = Select commit. Hold shift + click to pulls.review_only_possible_for_full_diff = Review is only possible when viewing the full diff pulls.filter_changes_by_commit = Filter by commit pulls.nothing_to_compare = These branches are equal. There is no need to create a pull request. +pulls.nothing_to_compare_bewtween_branch_and_tag = The selected branch and tag are equal. pulls.nothing_to_compare_and_allow_empty_pr = These branches are equal. This PR will be empty. pulls.has_pull_request = `A pull request between these branches already exists: %[2]s#%[3]d` pulls.create = Create Pull Request diff --git a/templates/repo/diff/compare.tmpl b/templates/repo/diff/compare.tmpl index a63d4801d194f..a815f9516831e 100644 --- a/templates/repo/diff/compare.tmpl +++ b/templates/repo/diff/compare.tmpl @@ -176,8 +176,8 @@ - {{if and .PageIsComparePull .IsNothingToCompare}} - {{if and $.IsSigned $.AllowEmptyPr (not .Repository.IsArchived)}} + {{if .IsNothingToCompare}} + {{if and $.IsSigned $.AllowEmptyPr (not .Repository.IsArchived) .PageIsComparePull}}
{{.locale.Tr "repo.pulls.nothing_to_compare_and_allow_empty_pr"}}
@@ -185,8 +185,10 @@
{{template "repo/issue/new_form" .}}
- {{else}} + {{else if .PageIsComparePull}}
{{.locale.Tr "repo.pulls.nothing_to_compare"}}
+ {{else}} +
{{.locale.Tr "repo.pulls.nothing_to_compare_bewtween_branch_and_tag"}}
{{end}} {{else if and .PageIsComparePull (gt .CommitCount 0)}} {{if .HasPullRequest}} From 689b136442f6bb609c77a1ca2d8e0e05f87b97ff Mon Sep 17 00:00:00 2001 From: yp05327 <576951401@qq.com> Date: Mon, 28 Aug 2023 05:16:26 +0000 Subject: [PATCH 4/4] improve --- options/locale/locale_en-US.ini | 2 +- templates/repo/diff/compare.tmpl | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/options/locale/locale_en-US.ini b/options/locale/locale_en-US.ini index 1ef36030d93d8..d46ce7f54ec15 100644 --- a/options/locale/locale_en-US.ini +++ b/options/locale/locale_en-US.ini @@ -1692,7 +1692,7 @@ pulls.select_commit_hold_shift_for_range = Select commit. Hold shift + click to pulls.review_only_possible_for_full_diff = Review is only possible when viewing the full diff pulls.filter_changes_by_commit = Filter by commit pulls.nothing_to_compare = These branches are equal. There is no need to create a pull request. -pulls.nothing_to_compare_bewtween_branch_and_tag = The selected branch and tag are equal. +pulls.nothing_to_compare_have_tag = The selected branch/tag are equal. pulls.nothing_to_compare_and_allow_empty_pr = These branches are equal. This PR will be empty. pulls.has_pull_request = `A pull request between these branches already exists: %[2]s#%[3]d` pulls.create = Create Pull Request diff --git a/templates/repo/diff/compare.tmpl b/templates/repo/diff/compare.tmpl index a815f9516831e..a8ac83ad86ee6 100644 --- a/templates/repo/diff/compare.tmpl +++ b/templates/repo/diff/compare.tmpl @@ -185,10 +185,10 @@
{{template "repo/issue/new_form" .}}
- {{else if .PageIsComparePull}} + {{else if and .HeadIsBranch .BaseIsBranch}}
{{.locale.Tr "repo.pulls.nothing_to_compare"}}
{{else}} -
{{.locale.Tr "repo.pulls.nothing_to_compare_bewtween_branch_and_tag"}}
+
{{.locale.Tr "repo.pulls.nothing_to_compare_have_tag"}}
{{end}} {{else if and .PageIsComparePull (gt .CommitCount 0)}} {{if .HasPullRequest}}