1
0

fix(projects): don't allow making a project child of itself

This commit is contained in:
kolaente
2023-03-27 12:56:01 +02:00
parent aafcb0bac4
commit b482664d82
3 changed files with 35 additions and 1 deletions

View File

@ -641,6 +641,12 @@ func checkProjectBeforeUpdateOrDelete(s *xorm.Session, project *Project) error {
// Check if the parent project exists
if project.ParentProjectID > 0 {
if project.ParentProjectID == project.ID {
return &ErrProjectCannotBeChildOfItself{
ProjectID: project.ID,
}
}
_, err := GetProjectSimpleByID(s, project.ParentProjectID)
if err != nil {
return err