fix(user): don't prevent deleting a user if their default project was shared
continuous-integration/drone/push Build is passing Details

Resolves vikunja/api#1595
This commit is contained in:
kolaente 2023-08-25 15:14:25 +02:00
parent 49d8713388
commit 693a77ae51
Signed by: konrad
GPG Key ID: F40E70337AB24C9B
1 changed files with 3 additions and 1 deletions

View File

@ -138,7 +138,9 @@ func DeleteUser(s *xorm.Session, u *user.User) (err error) {
for _, p := range projectsToDelete {
err = p.Delete(s, u)
if err != nil {
// If the user is the owner of the default project it will be deleted, if they are not the owner
// we can ignore the error as the project was shared in that case.
if err != nil && !IsErrCannotDeleteDefaultProject(err) {
return err
}
}