Skip to content

Commit e124ce9

Browse files
authored
Merge branch 'v15/dev' into v15/feature/hide-icons
2 parents e05eb84 + 1752be9 commit e124ce9

File tree

93 files changed

+1329
-435
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

93 files changed

+1329
-435
lines changed

src/Umbraco.Cms.Api.Management/Controllers/Document/Item/SearchDocumentItemController.cs

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
using Asp.Versioning;
1+
using System.Text.Json.Serialization;
2+
using Asp.Versioning;
23
using Microsoft.AspNetCore.Http;
34
using Microsoft.AspNetCore.Mvc;
45
using Umbraco.Cms.Api.Management.Factories;
@@ -26,12 +27,17 @@ public SearchDocumentItemController(IIndexedEntitySearchService indexedEntitySea
2627
public async Task<IActionResult> Search(CancellationToken cancellationToken, string query, int skip = 0, int take = 100)
2728
=> await SearchFromParent(cancellationToken, query, skip, take);
2829

30+
[NonAction]
31+
[Obsolete("Scheduled to be removed in v16, use the non obsoleted method instead")]
32+
public async Task<IActionResult> SearchFromParent(CancellationToken cancellationToken, string query, int skip = 0, int take = 100, Guid? parentId = null)
33+
=> await SearchFromParentWithAllowedTypes(cancellationToken, query, skip, take, parentId);
34+
2935
[HttpGet("search")]
3036
[MapToApiVersion("1.0")]
3137
[ProducesResponseType(typeof(PagedModel<DocumentItemResponseModel>), StatusCodes.Status200OK)]
32-
public async Task<IActionResult> SearchFromParent(CancellationToken cancellationToken, string query, int skip = 0, int take = 100, Guid? parentId = null)
38+
public async Task<IActionResult> SearchFromParentWithAllowedTypes(CancellationToken cancellationToken, string query, int skip = 0, int take = 100, Guid? parentId = null, [FromQuery]IEnumerable<Guid>? allowedDocumentTypes = null)
3339
{
34-
PagedModel<IEntitySlim> searchResult = _indexedEntitySearchService.Search(UmbracoObjectTypes.Document, query, parentId, skip, take);
40+
PagedModel<IEntitySlim> searchResult = _indexedEntitySearchService.Search(UmbracoObjectTypes.Document, query, parentId, allowedDocumentTypes, skip, take);
3541
var result = new PagedModel<DocumentItemResponseModel>
3642
{
3743
Items = searchResult.Items.OfType<IDocumentEntitySlim>().Select(_documentPresentationFactory.CreateItemResponseModel),

src/Umbraco.Cms.Api.Management/Controllers/Media/Item/SearchMediaItemController.cs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,18 @@ public SearchMediaItemController(IIndexedEntitySearchService indexedEntitySearch
2626
public async Task<IActionResult> Search(CancellationToken cancellationToken, string query, int skip = 0, int take = 100)
2727
=> await SearchFromParent(cancellationToken, query, skip, take, null);
2828

29+
[NonAction]
30+
[Obsolete("Scheduled to be removed in v16, use the non obsoleted method instead")]
31+
[ProducesResponseType(typeof(PagedModel<MediaItemResponseModel>), StatusCodes.Status200OK)]
32+
public async Task<IActionResult> SearchFromParent(CancellationToken cancellationToken, string query, int skip = 0, int take = 100, Guid? parentId = null)
33+
=> await SearchFromParentWithAllowedTypes(cancellationToken, query, skip, take, parentId);
34+
2935
[HttpGet("search")]
3036
[MapToApiVersion("1.0")]
3137
[ProducesResponseType(typeof(PagedModel<MediaItemResponseModel>), StatusCodes.Status200OK)]
32-
public async Task<IActionResult> SearchFromParent(CancellationToken cancellationToken, string query, int skip = 0, int take = 100, Guid? parentId = null)
38+
public async Task<IActionResult> SearchFromParentWithAllowedTypes(CancellationToken cancellationToken, string query, int skip = 0, int take = 100, Guid? parentId = null, [FromQuery]IEnumerable<Guid>? allowedMediaTypes = null)
3339
{
34-
PagedModel<IEntitySlim> searchResult = _indexedEntitySearchService.Search(UmbracoObjectTypes.Media, query, parentId, skip, take);
40+
PagedModel<IEntitySlim> searchResult = _indexedEntitySearchService.Search(UmbracoObjectTypes.Media, query, parentId, allowedMediaTypes, skip, take);
3541
var result = new PagedModel<MediaItemResponseModel>
3642
{
3743
Items = searchResult.Items.OfType<IMediaEntitySlim>().Select(_mediaPresentationFactory.CreateItemResponseModel),

src/Umbraco.Cms.Api.Management/Controllers/Member/Item/SearchMemberItemController.cs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,17 @@ public SearchMemberItemController(IIndexedEntitySearchService indexedEntitySearc
2121
_memberPresentationFactory = memberPresentationFactory;
2222
}
2323

24+
[NonAction]
25+
[Obsolete("Scheduled to be removed in v16, use the non obsoleted method instead")]
26+
public async Task<IActionResult> Search(CancellationToken cancellationToken, string query, int skip = 0, int take = 100)
27+
=> await SearchWithAllowedTypes(cancellationToken, query, skip, take);
28+
2429
[HttpGet("search")]
2530
[MapToApiVersion("1.0")]
2631
[ProducesResponseType(typeof(PagedModel<MemberItemResponseModel>), StatusCodes.Status200OK)]
27-
public async Task<IActionResult> Search(CancellationToken cancellationToken, string query, int skip = 0, int take = 100)
32+
public async Task<IActionResult> SearchWithAllowedTypes(CancellationToken cancellationToken, string query, int skip = 0, int take = 100, [FromQuery]IEnumerable<Guid>? allowedMemberTypes = null)
2833
{
29-
PagedModel<IEntitySlim> searchResult = _indexedEntitySearchService.Search(UmbracoObjectTypes.Member, query, skip, take);
34+
PagedModel<IEntitySlim> searchResult = _indexedEntitySearchService.Search(UmbracoObjectTypes.Member, query, null, allowedMemberTypes, skip, take);
3035
var result = new PagedModel<MemberItemResponseModel>
3136
{
3237
Items = searchResult.Items.OfType<IMemberEntitySlim>().Select(_memberPresentationFactory.CreateItemResponseModel),

src/Umbraco.Cms.Api.Management/Factories/DocumentUrlFactory.cs

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,38 @@
11
using Microsoft.Extensions.DependencyInjection;
2-
using Microsoft.Extensions.Logging;
32
using Umbraco.Cms.Api.Management.ViewModels.Document;
43
using Umbraco.Cms.Core.DependencyInjection;
54
using Umbraco.Cms.Core.Models;
6-
using Umbraco.Cms.Core.Models.PublishedContent;
7-
using Umbraco.Cms.Core.PublishedCache;
85
using Umbraco.Cms.Core.Routing;
96
using Umbraco.Cms.Core.Services;
10-
using Umbraco.Cms.Core.Services.Navigation;
11-
using Umbraco.Cms.Core.Web;
12-
using Umbraco.Extensions;
137

148
namespace Umbraco.Cms.Api.Management.Factories;
159

1610
public class DocumentUrlFactory : IDocumentUrlFactory
1711
{
18-
private readonly IDocumentUrlService _documentUrlService;
12+
private readonly IPublishedUrlInfoProvider _publishedUrlInfoProvider;
1913

2014

15+
[Obsolete("Use the constructor that takes all dependencies, scheduled for removal in v16")]
2116
public DocumentUrlFactory(IDocumentUrlService documentUrlService)
17+
: this(StaticServiceProvider.Instance.GetRequiredService<IPublishedUrlInfoProvider>())
2218
{
23-
_documentUrlService = documentUrlService;
19+
}
20+
21+
[Obsolete("Use the constructor that takes all dependencies, scheduled for removal in v16")]
22+
public DocumentUrlFactory(IDocumentUrlService documentUrlService, IPublishedUrlInfoProvider publishedUrlInfoProvider)
23+
: this(publishedUrlInfoProvider)
24+
{
25+
26+
}
27+
28+
public DocumentUrlFactory(IPublishedUrlInfoProvider publishedUrlInfoProvider)
29+
{
30+
_publishedUrlInfoProvider = publishedUrlInfoProvider;
2431
}
2532

2633
public async Task<IEnumerable<DocumentUrlInfo>> CreateUrlsAsync(IContent content)
2734
{
28-
IEnumerable<UrlInfo> urlInfos = await _documentUrlService.ListUrlsAsync(content.Key);
35+
ISet<UrlInfo> urlInfos = await _publishedUrlInfoProvider.GetAllAsync(content);
2936

3037
return urlInfos
3138
.Where(urlInfo => urlInfo.IsUrl)

src/Umbraco.Cms.Api.Management/Factories/IDocumentUrlFactory.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,6 @@ namespace Umbraco.Cms.Api.Management.Factories;
66
public interface IDocumentUrlFactory
77
{
88
Task<IEnumerable<DocumentUrlInfo>> CreateUrlsAsync(IContent content);
9+
910
Task<IEnumerable<DocumentUrlInfoResponseModel>> CreateUrlSetsAsync(IEnumerable<IContent> contentItems);
1011
}

src/Umbraco.Cms.Api.Management/OpenApi.json

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10086,6 +10086,17 @@
1008610086
"type": "string",
1008710087
"format": "uuid"
1008810088
}
10089+
},
10090+
{
10091+
"name": "allowedDocumentTypes",
10092+
"in": "query",
10093+
"schema": {
10094+
"type": "array",
10095+
"items": {
10096+
"type": "string",
10097+
"format": "uuid"
10098+
}
10099+
}
1008910100
}
1009010101
],
1009110102
"responses": {
@@ -15764,6 +15775,17 @@
1576415775
"type": "string",
1576515776
"format": "uuid"
1576615777
}
15778+
},
15779+
{
15780+
"name": "allowedMediaTypes",
15781+
"in": "query",
15782+
"schema": {
15783+
"type": "array",
15784+
"items": {
15785+
"type": "string",
15786+
"format": "uuid"
15787+
}
15788+
}
1576715789
}
1576815790
],
1576915791
"responses": {
@@ -19638,6 +19660,17 @@
1963819660
"format": "int32",
1963919661
"default": 100
1964019662
}
19663+
},
19664+
{
19665+
"name": "allowedMemberTypes",
19666+
"in": "query",
19667+
"schema": {
19668+
"type": "array",
19669+
"items": {
19670+
"type": "string",
19671+
"format": "uuid"
19672+
}
19673+
}
1964119674
}
1964219675
],
1964319676
"responses": {

src/Umbraco.Core/Configuration/Models/RuntimeSettings.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ public class RuntimeSettings
2121
/// <summary>
2222
/// Gets or sets a value for the maximum query string length.
2323
/// </summary>
24+
[Obsolete("No longer used and will be removed in Umbraco 16.")]
2425
public int? MaxQueryStringLength { get; set; }
2526

2627
/// <summary>

src/Umbraco.Core/DependencyInjection/UmbracoBuilder.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -241,6 +241,7 @@ private void AddCoreServices()
241241

242242
// register published router
243243
Services.AddUnique<IPublishedRouter, PublishedRouter>();
244+
Services.AddUnique<IPublishedUrlInfoProvider, PublishedUrlInfoProvider>();
244245

245246
Services.AddUnique<IEventMessagesFactory, DefaultEventMessagesFactory>();
246247
Services.AddUnique<IEventMessagesAccessor, HybridEventMessagesAccessor>();

src/Umbraco.Core/Models/ContentRepositoryExtensions.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@ public static void CopyFrom(this IContent content, IContent other, string? cultu
237237
{
238238
foreach (ContentCultureInfos cultureInfo in other.CultureInfos)
239239
{
240-
if (culture == "*" || culture == cultureInfo.Culture)
240+
if (culture == "*" || culture.InvariantEquals(cultureInfo.Culture))
241241
{
242242
content.SetCultureName(cultureInfo.Name, cultureInfo.Culture);
243243
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
using Umbraco.Cms.Core.Models;
2+
3+
namespace Umbraco.Cms.Core.Routing;
4+
5+
public interface IPublishedUrlInfoProvider
6+
{
7+
/// <summary>
8+
/// Gets all published urls for a content item.
9+
/// </summary>
10+
/// <param name="content">The content to get urls for.</param>
11+
/// <returns>Set of all published url infos.</returns>
12+
Task<ISet<UrlInfo>> GetAllAsync(IContent content);
13+
}

0 commit comments

Comments
 (0)