feat(projects): check parent project when checking archived status
This commit is contained in:
parent
5e2567645a
commit
18b9ff8512
@ -592,8 +592,7 @@ func addProjectDetails(s *xorm.Session, projects map[int64]*Project, a web.Auth)
|
||||
|
||||
// CheckIsArchived returns an ErrProjectIsArchived if the project or any of its parent projects is archived.
|
||||
func (p *Project) CheckIsArchived(s *xorm.Session) (err error) {
|
||||
// When creating a new project, we check if the parent is archived
|
||||
if p.ID == 0 {
|
||||
if p.ParentProjectID > 0 {
|
||||
p := &Project{ID: p.ParentProjectID}
|
||||
return p.CheckIsArchived(s)
|
||||
}
|
||||
@ -603,8 +602,6 @@ func (p *Project) CheckIsArchived(s *xorm.Session) (err error) {
|
||||
return err
|
||||
}
|
||||
|
||||
// TODO: parent project
|
||||
|
||||
if project.IsArchived {
|
||||
return ErrProjectIsArchived{ProjectID: p.ID}
|
||||
}
|
||||
@ -655,7 +652,6 @@ func CreateProject(s *xorm.Session, project *Project, auth web.Auth) (err error)
|
||||
|
||||
project.OwnerID = doer.ID
|
||||
project.Owner = doer
|
||||
project.ID = 0 // Otherwise only the first time a new project would be created
|
||||
|
||||
err = checkProjectBeforeUpdateOrDelete(s, project)
|
||||
if err != nil {
|
||||
|
Loading…
x
Reference in New Issue
Block a user