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

Prevent 500 is head repo does not have PullRequest unit in IsUserAllo… #20839

Merged

Conversation

zeripath
Copy link
Contributor

…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 #20621

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

…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>
@GiteaBot GiteaBot added the lgtm/need 1 This PR needs approval from one additional maintainer to be merged. label Aug 18, 2022
@GiteaBot GiteaBot added lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. and removed lgtm/need 1 This PR needs approval from one additional maintainer to be merged. labels Aug 18, 2022
@wolfbeast
Copy link

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

Wouldn't this cause confusion for merging if it's "not allowed to be merged" by returning false when the fork repo/PR source is having this error, that could be solved by making any change to the PR settings in the fork that makes the entries? The one normally doing the merging would not have access to the fork repo to know this...

@zeripath
Copy link
Contributor Author

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

Wouldn't this cause confusion for merging if it's "not allowed to be merged" by returning false when the fork repo/PR source is having this error, that could be solved by making any change to the PR settings in the fork that makes the entries? The one normally doing the merging would not have access to the fork repo to know this...

This PR is simply stopping the 500 and is easily backportable to 1.17.x

What you are describing is new UI handling which will require new translatable strings and so on. That will not be backportable to 1.17 without significant work.

Propose the UI and describe a reproducing testcase in another issue - but it is out of scope for this PR.

@wolfbeast
Copy link

What you are describing is new UI handling which will require new translatable strings and so on. That will not be backportable to 1.17 without significant work.

Yes understood :) I know l10n is the ever-looming issue when touching the UI or error messages (first hand experience).
I was just wondering if it was considered. Personally, I think making sure the db has the correct entries when migrating to an affected version would avoid having to do UI work altogether and could be a good follow-up, but I don't know how you normally handle something like this so I'll let you decide what direction to go here.
Sorry for the tangent.

@codecov-commenter
Copy link

Codecov Report

Merging #20839 (1803e6a) into main (03df7d0) will increase coverage by 0.32%.
The diff coverage is 0.00%.

❗ Current head 1803e6a differs from pull request most recent head c0192bb. Consider uploading reports for the commit c0192bb to get more accurate results

@@            Coverage Diff             @@
##             main   #20839      +/-   ##
==========================================
+ Coverage   46.74%   47.07%   +0.32%     
==========================================
  Files         989      989              
  Lines      136393   136395       +2     
==========================================
+ Hits        63761    64202     +441     
+ Misses      64778    64310     -468     
- Partials     7854     7883      +29     
Impacted Files Coverage Δ
services/pull/update.go 46.15% <0.00%> (-0.81%) ⬇️
modules/indexer/stats/indexer.go 51.06% <0.00%> (-6.39%) ⬇️
modules/notification/mail/mail.go 39.04% <0.00%> (-2.74%) ⬇️
modules/web/routing/funcinfo.go 91.89% <0.00%> (-2.71%) ⬇️
modules/notification/ui/ui.go 58.92% <0.00%> (-1.79%) ⬇️
modules/queue/queue_disk_channel.go 68.33% <0.00%> (-1.25%) ⬇️
models/notification.go 62.22% <0.00%> (-1.10%) ⬇️
models/issues/comment.go 50.43% <0.00%> (+0.43%) ⬆️
services/pull/pull.go 40.80% <0.00%> (+0.46%) ⬆️
... and 6 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@lafriks lafriks merged commit 0724ca4 into go-gitea:main Aug 18, 2022
@zeripath zeripath deleted the fix-20621-no-err-in-IsUserAllowedToUpdate branch August 18, 2022 10:31
zeripath added a commit to zeripath/gitea that referenced this pull request 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 pull request 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>
zjjhot added a commit to zjjhot/gitea that referenced this pull request Aug 19, 2022
* giteaofficial/main:
  Fix create repository page's help text (go-gitea#20810)
  In PushMirrorsIterate and MirrorsIterate if limit is negative do not set it (go-gitea#20837)
  Disable doctor logging on panic (go-gitea#20847)
  Remove calls to load Mirrors in user.Dashboard (go-gitea#20855)
  switch to node18 for snapcraft
  Prevent 500 is head repo does not have PullRequest unit in IsUserAllowedToUpdate (go-gitea#20839)
  Fix owners cannot create organization repos bug (go-gitea#20841)
@zeripath zeripath added the backport/done All backports for this PR have been created label Aug 21, 2022
vsysoev pushed a commit to IntegraSDL/gitea that referenced this pull request 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>
jolheiser pushed a commit that referenced this pull request Jan 18, 2023
…ed (#22512)

Swallow error just like in #20839, for the case where there is no
protected branch.

Fixes #20826 for me, though I can't tell if this now covers all cases.
jolheiser pushed a commit to jolheiser/gitea that referenced this pull request Jan 18, 2023
…ed (go-gitea#22512)

Swallow error just like in go-gitea#20839, for the case where there is no
protected branch.

Fixes go-gitea#20826 for me, though I can't tell if this now covers all cases.
@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
backport/done All backports for this PR have been created lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. type/bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Opening a PR in 1.17.0 results in a 500 error
8 participants