Added a default value for 'active' if it is null

When creating a project from json payload and the active field is
not specified it will now default to true instead of null.

This fixes an issue with projects not being assignable as parent projects
because they are "inactive".

Signed-off-by: Willie Nel <4620380+willienel@users.noreply.github.com>
This commit is contained in:
Willie Nel 2023-11-28 20:09:25 +01:00
parent 016c3320e6
commit 7ead801fea
2 changed files with 18 additions and 0 deletions

View file

@ -497,6 +497,9 @@ final class ProjectQueryManager extends QueryManager implements IQueryManager {
if (project.getParent() != null && !Boolean.TRUE.equals(project.getParent().isActive())){
throw new IllegalArgumentException("An inactive Parent cannot be selected as parent");
}
if (project.isActive() == null) {
project.setActive(Boolean.TRUE);
}
final Project result = persist(project);
final List<Tag> resolvedTags = resolveTags(tags);
bind(project, resolvedTags);