summaryrefslogtreecommitdiffstats
path: root/models/access.go
diff options
context:
space:
mode:
authorzeripath <art27@cantab.net>2021-09-28 07:41:12 +0100
committerGitHub <noreply@github.com>2021-09-28 07:41:12 +0100
commit4707d4b8a9fb0b29c71c46d788a8630e4a878a10 (patch)
tree21be4740bc5fef22b1a1682a9bd8d939431aadbe /models/access.go
parent4b8b2141084721ef87698dc4fb85e8491c5f8d7a (diff)
downloadgitea-4707d4b8a9fb0b29c71c46d788a8630e4a878a10.tar.gz
gitea-4707d4b8a9fb0b29c71c46d788a8630e4a878a10.zip
Nicely handle missing user in collaborations (#17049) (#17166)
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>
Diffstat (limited to 'models/access.go')
-rw-r--r--models/access.go3
1 files changed, 3 insertions, 0 deletions
diff --git a/models/access.go b/models/access.go
index d35b900cfd..264dbc6f60 100644
--- a/models/access.go
+++ b/models/access.go
@@ -225,6 +225,9 @@ func (repo *Repository) refreshCollaboratorAccesses(e Engine, accessMap map[int6
return fmt.Errorf("getCollaborations: %v", err)
}
for _, c := range collaborators {
+ if c.User.IsGhost() {
+ continue
+ }
updateUserAccess(accessMap, c.User, c.Collaboration.Mode)
}
return nil