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

Nicely handle missing user in collaborations #17049

Merged
merged 8 commits into from
Sep 27, 2021

Conversation

zeripath
Copy link
Contributor

It is possible to have a collaboration in a repository which refers to a no-longer
existing user. This causes the repository transfer to fail with an unusual error.

This PR makes repo.getCollaborators() nicely handle the missing user by ghosting
the collaboration but also adds consistency check. It also adds an
Access consistency check.

Fix #17044

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

It is possible to have a collaboration in a repository which refers to a no-longer
existing user. This causes the repository transfer to fail with an unusual error.

This PR makes `repo.getCollaborators()` nicely handle the missing user by ghosting
the collaboration but also adds consistency check. It also adds an
Access consistency check.

Fix go-gitea#17044

Signed-off-by: Andrew Thornton <art27@cantab.net>
@GiteaBot GiteaBot added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label Sep 14, 2021
@codecov-commenter
Copy link

codecov-commenter commented Sep 15, 2021

Codecov Report

Merging #17049 (d54cad0) into main (45ebcb0) will increase coverage by 0.02%.
The diff coverage is 3.44%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main   #17049      +/-   ##
==========================================
+ Coverage   45.22%   45.25%   +0.02%     
==========================================
  Files         766      766              
  Lines       86716    86647      -69     
==========================================
- Hits        39217    39208       -9     
+ Misses      41148    41090      -58     
+ Partials     6351     6349       -2     
Impacted Files Coverage Δ
models/access.go 70.55% <0.00%> (-0.80%) ⬇️
models/repo_transfer.go 42.25% <0.00%> (-1.23%) ⬇️
modules/doctor/dbconsistency.go 6.83% <0.00%> (+2.81%) ⬆️
models/repo_collaboration.go 57.33% <44.44%> (-1.29%) ⬇️
models/repo_mirror.go 58.69% <0.00%> (-10.87%) ⬇️
services/mirror/mirror.go 8.19% <0.00%> (-6.56%) ⬇️
models/gpg_key_common.go 59.67% <0.00%> (-4.84%) ⬇️
modules/cron/tasks_basic.go 85.43% <0.00%> (-2.92%) ⬇️
models/repo_list.go 77.64% <0.00%> (-0.79%) ⬇️
models/user.go 54.79% <0.00%> (+0.23%) ⬆️
... and 2 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 45ebcb0...d54cad0. Read the comment docs.

@GiteaBot GiteaBot added lgtm/need 1 This PR needs approval from one additional maintainer to be merged. and removed lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. labels Sep 15, 2021
zeripath and others added 2 commits September 16, 2021 11:54
Co-authored-by: KN4CK3R <admin@oldschoolhack.me>
@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 Sep 26, 2021
@zeripath
Copy link
Contributor Author

make lgtm work

@zeripath zeripath merged commit e8574f2 into go-gitea:main Sep 27, 2021
@zeripath zeripath deleted the fix-17044-prevent-error-if-no-collab branch September 27, 2021 18:07
zeripath added a commit to zeripath/gitea that referenced this pull request Sep 27, 2021
Backport go-gitea#17049

It is possible to have a collaboration in a repository which refers to a no-longer
existing user. This causes the repository transfer to fail with an unusual error.

This PR makes `repo.getCollaborators()` nicely handle the missing user by ghosting
the collaboration but also adds consistency check. It also adds an
Access consistency check.

Fix go-gitea#17044

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

Co-authored-by: KN4CK3R <admin@oldschoolhack.me>
@zeripath zeripath added the backport/done All backports for this PR have been created label Sep 27, 2021
zeripath added a commit that referenced this pull request Sep 28, 2021
Backport #17049

It is possible to have a collaboration in a repository which refers to a no-longer
existing user. This causes the repository transfer to fail with an unusual error.

This PR makes `repo.getCollaborators()` nicely handle the missing user by ghosting
the collaboration but also adds consistency check. It also adds an
Access consistency check.

Fix #17044

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

Co-authored-by: KN4CK3R <admin@oldschoolhack.me>
@go-gitea go-gitea locked and limited conversation to collaborators Apr 28, 2022
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.

500 error when when trying to transfer repository from user to organization
7 participants