* 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>
Once a branch has been merged if the commit ID no longer equals that of
the pulls ref commit id don't offer to delete the branch on the pull screen
and don't list it as merged on branches.
Fix#9201
When looking at the pull page we should also get the commits from the refs/pulls/x/head
Fix#9158
* add download-button info message
* add overflow-visible css for table colum class
* right colum is always there
* add download button for default branch
* add download button for all other branchs
* resize table colum so two buttons fit in
* code indent avter rebase
* show commit divergence corect
https://github.com/go-gitea/gitea/issues/7625
* changes because of merge master into ...
* optimize if statement for protected branches
* dont downloat a deleted branch - fix error 404
The default branch's name on the branches page
for a repo was previously simply text and did
not link anywhere.
The name is now a link to the default branch
just like the non-default branch names.
Signed-off-by: Gary Kim <gary@garykim.dev>
* Add branch protection information to branches page
This change will add a tag on the ui that indicates
whether a branch is protected on the repository
branches page.
Signed-off-by: Gary Kim <gary@garykim.dev>
* Add last commit information to repo branches page
This change adds the ID and commit message of the last
commit on a branch to the branches page for repositories.
Signed-off-by: Gary Kim <gary@garykim.dev>
* Make branch page commit message truncate in css rather then template
The truncating of commit messages shown under branches
in the repository branches page has been moved to using
css rather then the Go template as the template was causing
some issues when the commit messaged had a link when rendered.
This commit also makes the commit message paragraph itself
use flex in order to make managing its elements easier.
Signed-off-by: Gary Kim <gary@garykim.dev>
* Show Pull Request button or status of latest PR in branch list
Signed-off-by: Mario Lubenka <mario.lubenka@googlemail.com>
* Do not show pull request button on deleted branches
Signed-off-by: Mario Lubenka <mario.lubenka@googlemail.com>
* Do not show commit divergence on deleted branches
Signed-off-by: Mario Lubenka <mario.lubenka@googlemail.com>
* Use XORMs Get instead of limit
* Links pull request ID and use smaller labels for displaying the pull request status
Signed-off-by: Mario Lubenka <mario.lubenka@googlemail.com>
* Handle error when getting latest pull request
Signed-off-by: Mario Lubenka <mario.lubenka@googlemail.com>
* Indent template
Signed-off-by: Mario Lubenka <mario.lubenka@googlemail.com>
* Check error when loading issue
Signed-off-by: Mario Lubenka <mario.lubenka@googlemail.com>
* Call Git API to determine divergence of a branch and its base branch
Signed-off-by: Mario Lubenka <mario.lubenka@googlemail.com>
* Show commit divergance in branch list
Signed-off-by: Mario Lubenka <mario.lubenka@googlemail.com>
* Adds missing comment
Signed-off-by: Mario Lubenka <mario.lubenka@googlemail.com>
* Adds test for diverging commits
Signed-off-by: Mario Lubenka <mario.lubenka@googlemail.com>
* Try comparing commits instead of branches
Signed-off-by: Mario Lubenka <mario.lubenka@googlemail.com>
* Removes test as CI can't run it
Signed-off-by: Mario Lubenka <mario.lubenka@googlemail.com>
* Adjusts signature of percentage function to allow providing multiple integers as numerator
Signed-off-by: Mario Lubenka <mario.lubenka@googlemail.com>
* Moves CountDivergingCommits function into repofiles module
Signed-off-by: Mario Lubenka <mario.lubenka@googlemail.com>
* refactor struct's time to remove unnecessary memory usage
* use AsTimePtr simple code
* fix tests
* fix time compare
* fix template on gpg
* use AddDuration instead of Add