Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/v13/dev' into v13/feature/webh…
Browse files Browse the repository at this point in the history
…ook-all-the-things
  • Loading branch information
warrenbuckley committed Nov 22, 2023
2 parents 3897c56 + 1c2602f commit 80c3806
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 5 deletions.
12 changes: 10 additions & 2 deletions src/Umbraco.Web.BackOffice/Controllers/EntityController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ public class EntityController : UmbracoAuthorizedJsonController

private readonly AppCaches _appCaches;
private readonly IDynamicRootService _dynamicRootService;
private readonly IVariationContextAccessor _variationContextAccessor;
private readonly IBackOfficeSecurityAccessor _backofficeSecurityAccessor;
private readonly IContentService _contentService;
private readonly IContentTypeService _contentTypeService;
Expand Down Expand Up @@ -111,7 +112,8 @@ public EntityController(
IUserService userService,
ILocalizationService localizationService,
AppCaches appCaches,
IDynamicRootService dynamicRootService)
IDynamicRootService dynamicRootService,
IVariationContextAccessor variationContextAccessor)
{
_treeService = treeService ?? throw new ArgumentNullException(nameof(treeService));
_treeSearcher = treeSearcher ?? throw new ArgumentNullException(nameof(treeSearcher));
Expand Down Expand Up @@ -139,6 +141,7 @@ public EntityController(
_localizationService = localizationService ?? throw new ArgumentNullException(nameof(localizationService));
_appCaches = appCaches ?? throw new ArgumentNullException(nameof(appCaches));
_dynamicRootService = dynamicRootService;
_variationContextAccessor = variationContextAccessor;
}

[Obsolete("Use non-obsolete ctor. This will be removed in Umbraco 14.")]
Expand Down Expand Up @@ -183,7 +186,8 @@ public EntityController(
userService,
localizationService,
appCaches,
StaticServiceProvider.Instance.GetRequiredService<IDynamicRootService>())
StaticServiceProvider.Instance.GetRequiredService<IDynamicRootService>(),
StaticServiceProvider.Instance.GetRequiredService<IVariationContextAccessor>())
{

}
Expand Down Expand Up @@ -587,6 +591,8 @@ public class DynamicRootViewModel
public DynamicRoot Query { get; set; } = null!;

public int CurrentId { get; set; }
public string? CurrentCulture { get; set; }
public string? CurrentSegment { get; set; }

public int ParentId { get; set; }
}
Expand Down Expand Up @@ -617,6 +623,8 @@ public class DynamicRootViewModel
AnyOfDocTypeKeys = x.AnyOfDocTypeKeys
})
};

_variationContextAccessor.VariationContext = new VariationContext(model.CurrentCulture, model.CurrentSegment);
var startNodes = (await _dynamicRootService.GetDynamicRootsAsync(startNodeSelector)).ToArray();

Guid? first = startNodes.Any() ? startNodes.First() : null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -366,7 +366,7 @@ function entityResource($q, $http, umbRequestHelper) {
'Failed to retrieve entity data for query ' + query);
},

getDynamicRoot: function (query, currentId, parentId) {
getDynamicRoot: function (query, currentId, parentId, culture, segment) {
return umbRequestHelper.resourcePromise(
$http.post(
umbRequestHelper.getApiUrl(
Expand All @@ -375,7 +375,9 @@ function entityResource($q, $http, umbRequestHelper) {
{
query: JSON.parse(query),
parentId: parentId,
currentId: currentId
currentId: currentId,
currentCulture: culture,
currentSegment: segment
}),
'Failed to retrieve entity data for query ' + query);
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -257,11 +257,13 @@ function contentPickerController($scope, $q, $routeParams, $location, entityReso
});
}
else if ($scope.model.config.startNode.dynamicRoot) {

entityResource.getDynamicRoot(
JSON.stringify($scope.model.config.startNode.dynamicRoot),
editorState.current.id,
editorState.current.parentId,
"Document"
$scope.model.culture,
$scope.model.segment
).then(function (ent) {
if(ent) {
dialogOptions.startNodeId = ($scope.model.config.idType === "udi" ? ent.udi : ent.id).toString();
Expand Down

0 comments on commit 80c3806

Please sign in to comment.