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

Incorrect URL for compare button on non forked repos not owned by user #5924

Closed
5 tasks
juanpablo-santos opened this issue Feb 1, 2019 · 5 comments
Closed
5 tasks
Labels
issue/confirmed Issue has been reviewed and confirmed to be present or accepted to be implemented issue/regression Issue needs no code to be fixed, only a description on how to fix it yourself topic/ui Change the appearance of the Gitea UI type/bug
Milestone

Comments

@juanpablo-santos
Copy link
Contributor

  • Gitea version (or commit ref): 1.7.1
  • Git version: 2.14.3
  • Operating system: Ubuntu
  • Database (use [x]):
    • PostgreSQL
    • [ X] MySQL
    • MSSQL
    • SQLite
  • Can you reproduce the bug at https://try.gitea.io:
    • [ X] Yes (see below, you need at least a couple of users to reproduce the bug)
    • No
    • Not relevant
  • Log gist:

Description

Hi,

we've recently migrated to 1.7.1, and the compare button is showing the .SignedUserName for repositories which are neither a fork nor owned by the user. This wasn't happening on 1.6.0.

Seems 5c30817 introduced this behaviour, as part of #5877 released on 1.7.1.

How to reproduce

on try.gitea.io, user perry1234 created repo test-repo123 and added perry1235 as a collaborator, with admin rights

test-repo123 has two branches. When perry1235 clicks on the compare button, he gets an incorrect URL (see attached screenshot)

Screenshots

image

@notgood
Copy link

notgood commented Feb 1, 2019

Confirming, copypasting my comment from #3727

Broken for me since today upgrade to 1.7.1.

My scenario: repo owned by organization, no forks, green compare button generates link /orgname/reponame/compare/master...MyUsername:master, which is failing horribly with 404.
Going through Pull Requests->New Pull Request generates /orgname/reponame/compare/master...master, working as expected.

@zeripath zeripath added type/bug topic/ui Change the appearance of the Gitea UI issue/confirmed Issue has been reviewed and confirmed to be present or accepted to be implemented issue/regression Issue needs no code to be fixed, only a description on how to fix it yourself backport/v1.7 labels Feb 1, 2019
@zeripath
Copy link
Contributor

zeripath commented Feb 1, 2019

OK let's try to work out what the links should be. I'm struggling a little with this, I guess it should always be:

Compare the current repo and branch with the base repo and default branch.

So what was the problem in #3727 ? Well the problem is that make pull request is dependent on write access because https://github.com/go-gitea/gitea/blob/master/routers/repo/pull.go#L687 demands it.

@adelowo
Copy link
Member

adelowo commented Feb 1, 2019

While this is a bug, Can we actually create the fork for the user instead of throwing a 404? I think GitHub does this.

@zeripath
Copy link
Contributor

zeripath commented Feb 1, 2019

Hmm. I'm actually thinking we should check perm.CanReadIssuesOrPulls(true) just like we check when creating an issue. (Despite it's name the permission to write to issues/pulls is about assigning assignees etc. not about creating them.)

@zeripath
Copy link
Contributor

zeripath commented Feb 1, 2019

So there's a secondary issue that users cannot just type into the query field and type their own repository to move the compare to their repository.

@lafriks lafriks added this to the 1.7.2 milestone Feb 4, 2019
@lafriks lafriks closed this as completed Feb 4, 2019
@lafriks lafriks modified the milestones: 1.7.2, 1.7.3 Feb 16, 2019
@go-gitea go-gitea locked and limited conversation to collaborators Nov 24, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
issue/confirmed Issue has been reviewed and confirmed to be present or accepted to be implemented issue/regression Issue needs no code to be fixed, only a description on how to fix it yourself topic/ui Change the appearance of the Gitea UI type/bug
Projects
None yet
Development

No branches or pull requests

5 participants