diff --git a/pkg/models/project.go b/pkg/models/project.go index 05df0e681..5abdd82f2 100644 --- a/pkg/models/project.go +++ b/pkg/models/project.go @@ -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 {