Skip to content
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

Open to Pull Request form directly on compare page #30217

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

silverwind
Copy link
Member

@silverwind silverwind commented Mar 31, 2024

When creating a PR on Gitea, there is this useless step where one has to click a button on the compare page. Removed it. Note, I'm not yet sure what the relation to .Flash here is.

Screenshot 2024-03-31 at 19 19 39

Instead, remove this button and show the form directly. This matches GitHub's behaviour as well.

Screenshot 2024-03-31 at 19 19 50

@GiteaBot GiteaBot added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label Mar 31, 2024
@pull-request-size pull-request-size bot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Mar 31, 2024
@github-actions github-actions bot added modifies/templates This PR modifies the template files modifies/js labels Mar 31, 2024
Copy link
Member

@delvh delvh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Finally.
I was waiting for this PR for too long

templates/repo/diff/compare.tmpl Show resolved Hide resolved
@GiteaBot GiteaBot added lgtm/need 1 This PR needs approval from one additional maintainer to be merged. and removed lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. labels Mar 31, 2024
@silverwind silverwind added the backport/v1.22 This PR should be backported to Gitea 1.22 label Mar 31, 2024
@silverwind
Copy link
Member Author

I'm willing to backport this nice enhancement to 1.22.

@lunny
Copy link
Member

lunny commented Apr 1, 2024

It depends on whether the repository is archived/mirror and whether the compared are two branches.

@wxiaoguang
Copy link
Contributor

wxiaoguang commented Apr 1, 2024

Many show-form classes for <a class="show-form"> should be also removed IMO. They were no-op from beginning.

@silverwind silverwind marked this pull request as draft April 3, 2024 01:16
@silverwind
Copy link
Member Author

silverwind commented Apr 13, 2024

It depends on whether the repository is archived/mirror and whether the compared are two branches.

The if condition on the form have not changed. I just moved one condition that was on the button to th form. Behaviour for showing the form is the same as was previously for the button.

@silverwind
Copy link
Member Author

Many show-form classes for <a class="show-form"> should be also removed IMO. They were no-op from beginning.

Removed them and did some minor styling tweaks on that box:

Screenshot 2024-04-13 at 22 06 57

@silverwind silverwind marked this pull request as ready for review April 13, 2024 20:08
@silverwind
Copy link
Member Author

Ready again.

@silverwind silverwind added the type/enhancement An improvement of existing functionality label Apr 13, 2024
@lunny
Copy link
Member

lunny commented Apr 14, 2024

But sometimes, you just want to do a compare but not create a pull request?

@silverwind
Copy link
Member Author

But sometimes, you just want to do a compare but not create a pull request?

You always have the diff to compare at bottom. I see GitHub UI features the button on compare page as well, but I think under some circumstances the button is hidden and it opens directly to the form:

main...release/v1.22

I think we don't need such complications, we can make the form sufficiently compact and then the page will work for both purposes.

@lunny
Copy link
Member

lunny commented Apr 14, 2024

But sometimes, you just want to do a compare but not create a pull request?

You always have the diff to compare at bottom. I see GitHub UI features the button on compare page as well, but I think under some circumstances the button is hidden and it opens directly to the form:

main...release/v1.22

I think we don't need such complications, we can make the form sufficiently compact and then the page will work for both purposes.

But that will bothering. The previous design, there is only 1 line as a hint, but know whatever you want to create or not create a pull request, you will always see the creating pull request form.

@silverwind
Copy link
Member Author

silverwind commented Apr 14, 2024

Maybe we just need a way to skip the button in certain situations. On GitHub, I can open /user/repo/pull/new/branch (from SSH message) and if there is no PR yet, it will open directly to the form. On gitea, I think it links to the compare page and always requires clicking the button.

Another potential difference with GitHub is that when the diff and/or commit count is small it only shows the diff, not the commit list.

@silverwind silverwind marked this pull request as draft April 14, 2024 17:24
@silverwind
Copy link
Member Author

Checked how github does it:

https://github.com/silverwind/gitea/pull/new/rn

Redirects to

https://github.com/go-gitea/gitea/compare/main...silverwind:gitea:rn?expand=1

So we just need to implement the expand option and use it in places where it makes sense to open directly to the form.

@wxiaoguang wxiaoguang removed the backport/v1.22 This PR should be backported to Gitea 1.22 label Jun 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lgtm/need 1 This PR needs approval from one additional maintainer to be merged. modifies/js modifies/templates This PR modifies the template files size/M Denotes a PR that changes 30-99 lines, ignoring generated files. type/enhancement An improvement of existing functionality
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants