Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,9 @@ public RootDynamicRootOriginFinder(IEntityService entityService)
return null;
}

var entity = _entityService.Get(query.Context.ParentKey);
// when creating new content, CurrentKey will be null - fallback to using ParentKey
Guid entityKey = query.Context.CurrentKey ?? query.Context.ParentKey;
var entity = _entityService.Get(entityKey);

if (entity is null || _allowedObjectTypes.Contains(entity.NodeObjectType) is false)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,14 @@ public SiteDynamicRootOriginFinder(IEntityService entityService, IDomainService

public override Guid? FindOriginKey(DynamicRootNodeQuery query)
{
if (query.OriginAlias != SupportedOriginType || query.Context.CurrentKey.HasValue is false)
if (query.OriginAlias != SupportedOriginType)
{
return null;
}

IEntitySlim? entity = _entityService.Get(query.Context.CurrentKey.Value);
// when creating new content, CurrentKey will be null - fallback to using ParentKey
Guid entityKey = query.Context.CurrentKey ?? query.Context.ParentKey;
IEntitySlim? entity = _entityService.Get(entityKey);
if (entity is null || entity.NodeObjectType != Constants.ObjectTypes.Document)
{
return null;
Expand Down