Skip to content

Commit a31923c

Browse files
committed
Merge branch 'release/16.0'
# Conflicts: # src/Umbraco.Core/DependencyInjection/UmbracoBuilder.Collections.cs
2 parents f42328e + 2c58c70 commit a31923c

File tree

58 files changed

+683
-3114
lines changed

Some content is hidden

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

58 files changed

+683
-3114
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ public class AuthorizationCodeFlowSettings
144144
/// <value>
145145
/// The URLs allowed as redirect targets.
146146
/// </value>
147-
public ISet<Uri> LoginRedirectUrls { get; set; } = new HashSet<Uri>();
147+
public IEnumerable<Uri> LoginRedirectUrls { get; set; } = [];
148148

149149
/// <summary>
150150
/// Gets or sets the URLs allowed to use as redirect targets after a successful logout (session termination).
@@ -155,7 +155,7 @@ public class AuthorizationCodeFlowSettings
155155
/// <remarks>
156156
/// These are only required if logout is to be used.
157157
/// </remarks>
158-
public ISet<Uri> LogoutRedirectUrls { get; set; } = new HashSet<Uri>();
158+
public IEnumerable<Uri> LogoutRedirectUrls { get; set; } = [];
159159
}
160160

161161
/// <summary>

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,5 +98,5 @@ public class RequestHandlerSettings
9898
/// <summary>
9999
/// Add additional character replacements, or override defaults
100100
/// </summary>
101-
public ISet<CharItem> UserDefinedCharCollection { get; set; } = new HashSet<CharItem>();
101+
public IEnumerable<CharItem> UserDefinedCharCollection { get; set; } = [];
102102
}

src/Umbraco.Core/DependencyInjection/UmbracoBuilder.Collections.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,12 @@ internal static void AddAllCoreCollectionBuilders(this IUmbracoBuilder builder)
9595
builder.ContentIndexHandlers().Add(() => builder.TypeLoader.GetTypes<IContentIndexHandler>());
9696

9797
WebhookPayloadType webhookPayloadType = Constants.Webhooks.DefaultPayloadType;
98-
if (builder.Config.GetSection(Constants.Configuration.ConfigWebhookPayloadType).Value is not null)
98+
99+
// IntelliSense indicates that GetSection cannot return null. However, in certain unit test setups,
100+
// the configuration may not be fully initialized, leading to GetSection returning null. This null
101+
// check ensures that the code behaves correctly in such scenarios and prevents potential null
102+
// reference exceptions during testing.
103+
if (builder.Config.GetSection(Constants.Configuration.ConfigWebhookPayloadType)?.Value is not null)
99104
{
100105
webhookPayloadType = builder.Config.GetValue<WebhookPayloadType>(Constants.Configuration.ConfigWebhookPayloadType);
101106
}

src/Umbraco.Core/Services/ContentService.cs

Lines changed: 17 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1108,14 +1108,8 @@ public OperationResult Save(IContent content, int? userId = null, ContentSchedul
11081108

11091109
if (culturesChanging != null)
11101110
{
1111-
IEnumerable<string>? languages = _languageRepository.GetMany()?
1112-
.Where(x => culturesChanging.InvariantContains(x.IsoCode))
1113-
.Select(x => x.CultureName);
1114-
if (languages is not null)
1115-
{
1116-
var langs = string.Join(", ", languages);
1117-
Audit(AuditType.SaveVariant, userId.Value, content.Id, $"Saved languages: {langs}", langs);
1118-
}
1111+
var langs = GetLanguageDetailsForAuditEntry(culturesChanging);
1112+
Audit(AuditType.SaveVariant, userId.Value, content.Id, $"Saved languages: {langs}", langs);
11191113
}
11201114
else
11211115
{
@@ -1625,9 +1619,7 @@ void SaveDocument(IContent c)
16251619
if (culturesUnpublishing != null)
16261620
{
16271621
// This will mean that that we unpublished a mandatory culture or we unpublished the last culture.
1628-
var langs = string.Join(", ", allLangs
1629-
.Where(x => culturesUnpublishing.InvariantContains(x.IsoCode))
1630-
.Select(x => x.CultureName));
1622+
var langs = GetLanguageDetailsForAuditEntry(allLangs, culturesUnpublishing);
16311623
Audit(AuditType.UnpublishVariant, userId, content.Id, $"Unpublished languages: {langs}", langs);
16321624

16331625
if (publishResult == null)
@@ -1707,19 +1699,15 @@ void SaveDocument(IContent c)
17071699
case PublishResultType.SuccessPublishCulture:
17081700
if (culturesPublishing != null)
17091701
{
1710-
var langs = string.Join(", ", allLangs
1711-
.Where(x => culturesPublishing.InvariantContains(x.IsoCode))
1712-
.Select(x => x.CultureName));
1702+
var langs = GetLanguageDetailsForAuditEntry(allLangs, culturesPublishing);
17131703
Audit(AuditType.PublishVariant, userId, content.Id, $"Published languages: {langs}", langs);
17141704
}
17151705

17161706
break;
17171707
case PublishResultType.SuccessUnpublishCulture:
17181708
if (culturesUnpublishing != null)
17191709
{
1720-
var langs = string.Join(", ", allLangs
1721-
.Where(x => culturesUnpublishing.InvariantContains(x.IsoCode))
1722-
.Select(x => x.CultureName));
1710+
var langs = GetLanguageDetailsForAuditEntry(allLangs, culturesUnpublishing);
17231711
Audit(AuditType.UnpublishVariant, userId, content.Id, $"Unpublished languages: {langs}", langs);
17241712
}
17251713

@@ -1741,9 +1729,7 @@ void SaveDocument(IContent c)
17411729
{
17421730
if (culturesChanging != null)
17431731
{
1744-
var langs = string.Join(", ", allLangs
1745-
.Where(x => culturesChanging.InvariantContains(x.IsoCode))
1746-
.Select(x => x.CultureName));
1732+
var langs = GetLanguageDetailsForAuditEntry(allLangs, culturesChanging);
17471733
Audit(AuditType.SaveVariant, userId, content.Id, $"Saved languages: {langs}", langs);
17481734
}
17491735
else
@@ -3098,6 +3084,17 @@ internal IEnumerable<IContent> GetPublishedDescendantsLocked(IContent content)
30983084
private void Audit(AuditType type, int userId, int objectId, string? message = null, string? parameters = null) =>
30993085
_auditRepository.Save(new AuditItem(objectId, type, userId, UmbracoObjectTypes.Document.GetName(), message, parameters));
31003086

3087+
private string GetLanguageDetailsForAuditEntry(IEnumerable<string> affectedCultures)
3088+
=> GetLanguageDetailsForAuditEntry(_languageRepository.GetMany(), affectedCultures);
3089+
3090+
private static string GetLanguageDetailsForAuditEntry(IEnumerable<ILanguage> languages, IEnumerable<string> affectedCultures)
3091+
{
3092+
IEnumerable<string> languageIsoCodes = languages
3093+
.Where(x => affectedCultures.InvariantContains(x.IsoCode))
3094+
.Select(x => x.IsoCode);
3095+
return string.Join(", ", languageIsoCodes);
3096+
}
3097+
31013098
private static bool IsDefaultCulture(IReadOnlyCollection<ILanguage>? langs, string culture) =>
31023099
langs?.Any(x => x.IsDefault && x.IsoCode.InvariantEquals(culture)) ?? false;
31033100

src/Umbraco.Web.UI.Client/src/assets/lang/de-ch.ts

Lines changed: 0 additions & 17 deletions
This file was deleted.

0 commit comments

Comments
 (0)