-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Don't show new pr button when page is not compare pull #26431
Don't show new pr button when page is not compare pull #26431
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unrelated to this PR but I would ideally prefer if we eventually remove the need to click this button and just open directly into the PR form.
That's not a bug, |
Not a bug but a feature, need to write some comments for it. |
If empty PR is a feature, this change makes no sense. I'm sorry but I'll close it then. |
why not keep it open and write some comments? |
You mean make this PR comment-only? |
No, this is a bug, I know we can create empty pull request, but
So the root reason is that we forgot to check whether this is a tag selected in this compare page, not the problem of empty pull request. You can confirm the difference in GitHub: ps: I noticed this problem because I created a Release with |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
so looks this option is better: diff --git a/templates/repo/diff/compare.tmpl b/templates/repo/diff/compare.tmpl
index 3bb7c2e81..a63d4801d 100644
--- a/templates/repo/diff/compare.tmpl
+++ b/templates/repo/diff/compare.tmpl
@@ -176,7 +176,7 @@
</div>
</div>
- {{if .IsNothingToCompare}}
+ {{if and .PageIsComparePull .IsNothingToCompare}}
{{if and $.IsSigned $.AllowEmptyPr (not .Repository.IsArchived)}}
<div class="ui segment">{{.locale.Tr "repo.pulls.nothing_to_compare_and_allow_empty_pr"}}</div>
<div class="ui info message show-form-container {{if .Flash}}gt-hidden{{end}}">
@@ -229,7 +229,7 @@
{{end}}
{{$showDiffBox = true}}
{{end}}
- {{else}}
+ {{else if not .IsNothingToCompare}}
{{$showDiffBox = true}}
{{end}}
</div>
`` |
Retracting review for now. |
Done. |
But we still need the comment that the two branches are equal. |
|
Can we remove the "New PR" button altogether and just show the form directly if applicable? I'm willing to collaborate on this here. It would be nice to have for #26743 because it's rather unintuitive when you F5 on the new PR page and it does not immediatly show the restored content. |
* giteaofficial/main: [skip ci] Updated licenses and gitignores Prevent anonymous container access if `RequireSignInView` is enabled (go-gitea#28877) Don't show new pr button when page is not compare pull (go-gitea#26431) Avoid duplicate JS error messages on UI (go-gitea#28873) Fix branch list bug which displayed default branch twice (go-gitea#28878) Revert adding htmx until we finaly decide to add it (go-gitea#28879) Don't do a full page load when clicking the follow button (go-gitea#28872) Don't do a full page load when clicking the subscribe button (go-gitea#28871) Fix incorrect PostgreSQL connection string for Unix sockets (go-gitea#28865) Run `npm audit fix` (go-gitea#28866) Fix migrate storage bug (go-gitea#28830) Set the `isPermaLink` attribute to `false` in the `guid` sub-element (go-gitea#28860) In administration documentation about environment variables, point to those for the Go runtime instead of Go compiler (go-gitea#28859) Move doctor package from modules to services (go-gitea#28856) Add support for sha256 repositories (go-gitea#23894) Fix incorrect action duration time when rerun the job before executed once (go-gitea#28364) Fix some RPM registry flaws (go-gitea#28782) tests: missing refs/ in bare repositories (go-gitea#28844) Fix archive creating LFS hooks and breaking pull requests (go-gitea#28848)
Before: ![image](https://github.com/go-gitea/gitea/assets/18380374/ba69252f-3582-414a-9d62-b2b78d7035dd) After: ![image](https://github.com/go-gitea/gitea/assets/18380374/71b8587c-b96e-48fb-b3e5-1a2a8b5d06fa) (TestOrg:test is a tag not branch) Problem: In the template, we will not add `compare pull` class when `PageIsComparePull` is false. https://github.com/go-gitea/gitea/blob/a370efc13f0e1ea309e324639832832bc14cb6dc/templates/repo/diff/compare.tmpl#L2 But in the js, we are using `.repository.compare.pull` to find the button: https://github.com/go-gitea/gitea/blob/a370efc13f0e1ea309e324639832832bc14cb6dc/web_src/js/features/repo-legacy.js#L552-L563 So, if `PageIsComparePull` is false, the `New Pull Request` button will be there, but has no response when we click it.
Before: ![image](https://github.com/go-gitea/gitea/assets/18380374/ba69252f-3582-414a-9d62-b2b78d7035dd) After: ![image](https://github.com/go-gitea/gitea/assets/18380374/71b8587c-b96e-48fb-b3e5-1a2a8b5d06fa) (TestOrg:test is a tag not branch) Problem: In the template, we will not add `compare pull` class when `PageIsComparePull` is false. https://github.com/go-gitea/gitea/blob/a370efc13f0e1ea309e324639832832bc14cb6dc/templates/repo/diff/compare.tmpl#L2 But in the js, we are using `.repository.compare.pull` to find the button: https://github.com/go-gitea/gitea/blob/a370efc13f0e1ea309e324639832832bc14cb6dc/web_src/js/features/repo-legacy.js#L552-L563 So, if `PageIsComparePull` is false, the `New Pull Request` button will be there, but has no response when we click it.
Before:
After:
(TestOrg:test is a tag not branch)
Problem:
In the template, we will not add
compare pull
class whenPageIsComparePull
is false.gitea/templates/repo/diff/compare.tmpl
Line 2 in a370efc
But in the js, we are using
.repository.compare.pull
to find the button:gitea/web_src/js/features/repo-legacy.js
Lines 552 to 563 in a370efc
So, if
PageIsComparePull
is false, theNew Pull Request
button will be there, but has no response when we click it.