fix(projects): do not return parent project id when authenticating as link share
continuous-integration/drone/push Build is passing Details

Related to https://community.vikunja.io/t/vikunja-freezes/2246
Related to https://github.com/go-vikunja/vikunja/issues/233
This commit is contained in:
kolaente 2024-04-12 18:02:39 +02:00
parent 0bc9a670d7
commit 500b761fe6
Signed by: konrad
GPG Key ID: F40E70337AB24C9B
1 changed files with 8 additions and 0 deletions

View File

@ -146,6 +146,9 @@ func (p *Project) ReadAll(s *xorm.Session, a web.Auth, search string, page int,
}
projects := []*Project{project}
err = addProjectDetails(s, projects, a)
if err == nil && len(projects) > 0 {
projects[0].ParentProjectID = 0
}
return projects, 0, 0, err
}
@ -226,6 +229,11 @@ func (p *Project) ReadOne(s *xorm.Session, a web.Auth) (err error) {
p.OwnerID = sf.OwnerID
}
_, isShareAuth := a.(*LinkSharing)
if isShareAuth {
p.ParentProjectID = 0
}
// Get project owner
p.Owner, err = user.GetUserByID(s, p.OwnerID)
if err != nil {