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

Opening a PR in 1.17.0 results in a 500 error #20621

Closed
Toxik1983 opened this issue Aug 2, 2022 · 1 comment · Fixed by #20839
Closed

Opening a PR in 1.17.0 results in a 500 error #20621

Toxik1983 opened this issue Aug 2, 2022 · 1 comment · Fixed by #20839
Labels
Milestone

Comments

@Toxik1983
Copy link

Description

After migrating to version 1.17.0, some newly created PRs as well as some PRs that were previously created in version 1.16.9 now won't open and always result in a 500 error.
The logs always show the same error when trying to open an affected PR:

2022/08/02 10:07:13 ...vices/pull/update.go:109:IsUserAllowedToUpdate() [E] [62e8db31] pr.BaseRepo.GetUnit(unit.TypePullRequests): Unit type does not exist: TypePullRequests
2022/08/02 10:07:13 ...ers/web/repo/pull.go:509:PrepareViewPullInfo() [E] [62e8db31] IsUserAllowedToUpdate: Unit type does not exist: TypePullRequests
2022/08/02 10:07:13 [62e8db31] router: completed GET /-redacted-/backoffice-api/pulls/2323 for -redacted-:50108, 500 Internal Server Error in 135.1ms @ repo/issue.go:1122(repo.ViewIssue)

This seems to be the case for all PRs that originate from the fork of a user where, at least after migrating to 1.17.0, 'Enable Repository Pull Requests' is no longer enabled in the fork's Repository settings.
After (re-)enabling this option, the 500 error no longer occurs for PRs originating from that specific fork.

Gitea Version

1.17.0

Can you reproduce the bug on the Gitea demo site?

No

Log Gist

No response

Screenshots

No response

Git Version

No response

Operating System

No response

How are you running Gitea?

Official Docker image on Ubuntu Server

Database

No response

@zeripath
Copy link
Contributor

zeripath commented Aug 17, 2022

This seems to be the case for all PRs that originate from the fork of a user where, at least after migrating to 1.17.0, 'Enable Repository Pull Requests' is no longer enabled in the fork's Repository settings.
After (re-)enabling this option, the 500 error no longer occurs for PRs originating from that specific fork.

From what version of Gitea were you migrating from? How old was the fork? Was the fork working on the previous version?

Are there any other forks affected?

Do you have a backup of your db from before the migration that you could check the contents of the repo_units table for that repository?

There are no migrations in 1.17 that would cause the repo_units here to change - although we may now actually be testing for the presence. So it's probably that the repo_unit for PullRequests was never set and the repo should never been allowed to do PRs in the first place!!


If the repo does not have the PullRequest unit set, whilst we should not 500 the best we could do in that situation is send a forbidden - which doesn't get the user much further.

zeripath added a commit to zeripath/gitea that referenced this issue Aug 17, 2022
…wedToUpdate

Some repositories do not have the PullRequest unit present in their configuration
and unfortunately the way that IsUserAllowedToUpdate currently works assumes
that this is an error instead of just returning false.

This PR simply swallows this error allowing the function to return false.

Fix go-gitea#20621

Signed-off-by: Andrew Thornton <art27@cantab.net>
lafriks added a commit that referenced this issue Aug 18, 2022
…wedToUpdate (#20839)

Some repositories do not have the PullRequest unit present in their configuration
and unfortunately the way that IsUserAllowedToUpdate currently works assumes
that this is an error instead of just returning false.

This PR simply swallows this error allowing the function to return false.

Fix #20621

Signed-off-by: Andrew Thornton <art27@cantab.net>

Signed-off-by: Andrew Thornton <art27@cantab.net>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: Lauris BH <lauris@nix.lv>
zeripath added a commit to zeripath/gitea that referenced this issue Aug 18, 2022
…wedToUpdate (go-gitea#20839)

Backport go-gitea#20621

Some repositories do not have the PullRequest unit present in their configuration
and unfortunately the way that IsUserAllowedToUpdate currently works assumes
that this is an error instead of just returning false.

This PR simply swallows this error allowing the function to return false.

Fix go-gitea#20621

Signed-off-by: Andrew Thornton <art27@cantab.net>
techknowlogick pushed a commit that referenced this issue Aug 18, 2022
…wedToUpdate (#20839) (#20848)

Backport #20621

Some repositories do not have the PullRequest unit present in their configuration
and unfortunately the way that IsUserAllowedToUpdate currently works assumes
that this is an error instead of just returning false.

This PR simply swallows this error allowing the function to return false.

Fix #20621

Signed-off-by: Andrew Thornton <art27@cantab.net>

Signed-off-by: Andrew Thornton <art27@cantab.net>
vsysoev pushed a commit to IntegraSDL/gitea that referenced this issue Aug 28, 2022
…wedToUpdate (go-gitea#20839)

Some repositories do not have the PullRequest unit present in their configuration
and unfortunately the way that IsUserAllowedToUpdate currently works assumes
that this is an error instead of just returning false.

This PR simply swallows this error allowing the function to return false.

Fix go-gitea#20621

Signed-off-by: Andrew Thornton <art27@cantab.net>

Signed-off-by: Andrew Thornton <art27@cantab.net>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: Lauris BH <lauris@nix.lv>
@go-gitea go-gitea locked and limited conversation to collaborators May 3, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants