-
-
Notifications
You must be signed in to change notification settings - Fork 5.6k
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
Allow unauthenticated users to compare #11240
Conversation
These changes could also be previewed on my personal Gitea instance; note that browsing the FreeBSD repo isn't necessarily feasible in Gitea quite yet due to the massive number of subdirectories and fairly diverse/large history (edit to add: this performance is likely the next thing I am going to look at, to see if there is any room for improvement in gitea or go-git):
|
@kevans91 CI is failing (related) |
2f32b26
to
ed627ba
Compare
Apologies; still haven't worked out a means to execute any of the test suite over here, and I have no Linux machines/VMs for the Docker stuff inherently required. =-( |
@kevans91 no problem :) I dont know if tests works on windows or freebsd but building gitea should work :) |
Remove some bits of the compare interface if the user isn't signed in. Notably, they don't need to see the "New Pull Request" button box nor the hidden form that would fail to submit due to the POST request continuing to require proper privileges. Follow-up commits will improve the UI a bit around this, removing some "Pull Request" verbiage in favor of "Compare."
This change requires pulling in the BaseRepo unconditionally and recording if the pull request is in-fact not allowed (.PullRequestCtx.Allowed). If the user isn't allowed to create a pull request, either because this isn't a fork or same-fork branch PRs aren't allowed, then we'll name the button "Compare" instead of "Pull Request."
When viewing the branch listing as an unauthenticated user, you'll get "Pull Request" buttons. use the new "Compare" verbiage instead, which matches GitHub behavior when you can't issue a pull request from the branches.
Rebased now that pull #11264 landed, which added a formal grouping for /:username/:reponame endpoints that don't require authentication. |
Ping LG-TM |
* routers: make /compare route available to unauthenticated users Remove some bits of the compare interface if the user isn't signed in. Notably, they don't need to see the "New Pull Request" button box nor the hidden form that would fail to submit due to the POST request continuing to require proper privileges. Follow-up commits will improve the UI a bit around this, removing some "Pull Request" verbiage in favor of "Compare." * ui: home: show "compare" button for unauthenticated users This change requires pulling in the BaseRepo unconditionally and recording if the pull request is in-fact not allowed (.PullRequestCtx.Allowed). If the user isn't allowed to create a pull request, either because this isn't a fork or same-fork branch PRs aren't allowed, then we'll name the button "Compare" instead of "Pull Request." * ui: branch list: use the new Compare language when available When viewing the branch listing as an unauthenticated user, you'll get "Pull Request" buttons. use the new "Compare" verbiage instead, which matches GitHub behavior when you can't issue a pull request from the branches. Co-authored-by: zeripath <art27@cantab.net> Co-authored-by: guillep2k <18600385+guillep2k@users.noreply.github.com>
This brings Gitea slightly closer to GitHub parity as far as branch comparisons go. If a repository is public, there's no reason (that I can see) that unauthenticated users shouldn't be able to compare branches.
This pull request improves the unauthenticated user experience ever-so-slightly, by:
1.) Allowing unauthenticated users to compare branches,
2.) Adding "Compare" buttons for unauthenticated users to the repo's home route, so they can easily compare the branch they're viewing like they can on GitHub -- it goes where the Pull Request button normally goes, and actually just replaces the verbiage as the routes are the same.
3.) Changes "New Pull Request" verbiage on the branch listing (e.g. https://try.gitea.io/kevans/test_repo/branches/) to "Compare" for unauthenticated users, no longer leading to a sign-in form.