diff --git a/.github/workflows/publish-nuget.yml b/.github/workflows/publish-nuget.yml
index fac826db..8e61048b 100644
--- a/.github/workflows/publish-nuget.yml
+++ b/.github/workflows/publish-nuget.yml
@@ -8,6 +8,6 @@ on:
jobs:
publish-nuget:
name: Publish to NuGet
- uses: Lombiq/GitHub-Actions/.github/workflows/publish-nuget.yml@dev
+ uses: Lombiq/GitHub-Actions/.github/workflows/publish-nuget.yml@issue/OSOE-925
secrets:
API_KEY: ${{ secrets.DEFAULT_NUGET_PUBLISH_API_KEY }}
diff --git a/.github/workflows/validate-nuget-publish.yml b/.github/workflows/validate-nuget-publish.yml
index 9f8979c5..f0fd6be1 100644
--- a/.github/workflows/validate-nuget-publish.yml
+++ b/.github/workflows/validate-nuget-publish.yml
@@ -9,4 +9,4 @@ on:
jobs:
validate-nuget-publish:
name: Validate NuGet Publish
- uses: Lombiq/GitHub-Actions/.github/workflows/validate-nuget-publish.yml@dev
+ uses: Lombiq/GitHub-Actions/.github/workflows/validate-nuget-publish.yml@issue/OSOE-925
diff --git a/Lombiq.HelpfulExtensions.Tests.UI/Constants/GeneratedMigrationCodes.cs b/Lombiq.HelpfulExtensions.Tests.UI/Constants/GeneratedMigrationCodes.cs
index a856d224..e6fa7b6b 100644
--- a/Lombiq.HelpfulExtensions.Tests.UI/Constants/GeneratedMigrationCodes.cs
+++ b/Lombiq.HelpfulExtensions.Tests.UI/Constants/GeneratedMigrationCodes.cs
@@ -12,7 +12,7 @@ internal static class GeneratedMigrationCodes
private const string Page =
"""
await _contentDefinitionManager.AlterTypeDefinitionAsync("Page", type => type
- .DisplayedAs("Page")
+ .WithDisplayName("Page")
.Creatable()
.Listable()
.Draftable()
diff --git a/Lombiq.HelpfulExtensions.Tests.UI/Lombiq.HelpfulExtensions.Tests.UI.csproj b/Lombiq.HelpfulExtensions.Tests.UI/Lombiq.HelpfulExtensions.Tests.UI.csproj
index 79151198..4db637a3 100644
--- a/Lombiq.HelpfulExtensions.Tests.UI/Lombiq.HelpfulExtensions.Tests.UI.csproj
+++ b/Lombiq.HelpfulExtensions.Tests.UI/Lombiq.HelpfulExtensions.Tests.UI.csproj
@@ -1,7 +1,7 @@
- net8.0
+ net10.0
$(DefaultItemExcludes);.git*
@@ -27,7 +27,7 @@
-
+
OCCMA
@@ -41,7 +41,7 @@
-
+
diff --git a/Lombiq.HelpfulExtensions/Controllers/ContentSetController.cs b/Lombiq.HelpfulExtensions/Controllers/ContentSetController.cs
index ab7a2559..1f947ec4 100644
--- a/Lombiq.HelpfulExtensions/Controllers/ContentSetController.cs
+++ b/Lombiq.HelpfulExtensions/Controllers/ContentSetController.cs
@@ -23,7 +23,7 @@ public async Task Create(string fromContentItemId, string fromPar
if (!ModelState.IsValid) return BadRequest(ModelState);
return await _contentSetManager.CloneContentItemAsync(fromContentItemId, fromPartName, newKey) is { } content
- ? Redirect(_orchardHelper.GetItemEditUrl(content))
+ ? Redirect(await _orchardHelper.GetItemEditUrlAsync(content))
: NotFound();
}
}
diff --git a/Lombiq.HelpfulExtensions/Extensions/CodeGeneration/CodeGenerationDisplayDriver.cs b/Lombiq.HelpfulExtensions/Extensions/CodeGeneration/CodeGenerationDisplayDriver.cs
index bf330c36..b39339af 100644
--- a/Lombiq.HelpfulExtensions/Extensions/CodeGeneration/CodeGenerationDisplayDriver.cs
+++ b/Lombiq.HelpfulExtensions/Extensions/CodeGeneration/CodeGenerationDisplayDriver.cs
@@ -40,7 +40,7 @@ public override IDisplayResult Edit(ContentTypeDefinition model, BuildEditorCont
codeBuilder.AppendLine(
CultureInfo.InvariantCulture,
$"await _contentDefinitionManager.AlterTypeDefinitionAsync(\"{name}\", type => type");
- codeBuilder.AppendLine(CultureInfo.InvariantCulture, $" .DisplayedAs(\"{model.DisplayName}\")");
+ codeBuilder.AppendLine(CultureInfo.InvariantCulture, $" .WithDisplayName(\"{model.DisplayName}\")");
GenerateCodeForSettings(codeBuilder, model.GetSettings());
AddSettingsWithout(codeBuilder, model.Settings);
diff --git a/Lombiq.HelpfulExtensions/Extensions/Emails/Extensions/EmailSenderShellScopeExtensions.cs b/Lombiq.HelpfulExtensions/Extensions/Emails/Extensions/EmailSenderShellScopeExtensions.cs
index d6629e1e..a97d37d5 100644
--- a/Lombiq.HelpfulExtensions/Extensions/Emails/Extensions/EmailSenderShellScopeExtensions.cs
+++ b/Lombiq.HelpfulExtensions/Extensions/Emails/Extensions/EmailSenderShellScopeExtensions.cs
@@ -27,8 +27,7 @@ public static void SendEmailDeferred(this ShellScope shellScope, EmailParameters
Bcc = parameters.Bcc?.Join(","),
Subject = parameters.Subject,
ReplyTo = parameters.ReplyTo,
- Body = parameters.Body,
- IsHtmlBody = true,
+ HtmlBody = parameters.Body,
});
if (!result.Succeeded)
diff --git a/Lombiq.HelpfulExtensions/Extensions/Flows/Drivers/AdditionalStylingPartDisplay.cs b/Lombiq.HelpfulExtensions/Extensions/Flows/Drivers/AdditionalStylingPartDisplay.cs
index a106123a..47291d80 100644
--- a/Lombiq.HelpfulExtensions/Extensions/Flows/Drivers/AdditionalStylingPartDisplay.cs
+++ b/Lombiq.HelpfulExtensions/Extensions/Flows/Drivers/AdditionalStylingPartDisplay.cs
@@ -17,12 +17,7 @@ public override IDisplayResult Edit(ContentItem model, BuildEditorContext contex
public override async Task UpdateAsync(ContentItem model, UpdateEditorContext context)
{
- var additionalStylingPart = model.As();
-
- if (additionalStylingPart == null)
- {
- return null;
- }
+ if (!model.Has()) return null;
await model.AlterAsync(model => context.Updater.TryUpdateModelAsync(model, Prefix));
@@ -31,12 +26,8 @@ public override async Task UpdateAsync(ContentItem model, Update
private static void PopulateViewModel(ContentItem model, AdditionalStylingPart viewModel)
{
- var additionalStylingPart = model.As();
-
- if (additionalStylingPart != null)
- {
- viewModel.CustomClasses = additionalStylingPart.CustomClasses;
- viewModel.RemoveGridExtensionClasses = additionalStylingPart.RemoveGridExtensionClasses;
- }
+ if (!model.TryGet(out var additionalStylingPart)) return;
+ viewModel.CustomClasses = additionalStylingPart.CustomClasses;
+ viewModel.RemoveGridExtensionClasses = additionalStylingPart.RemoveGridExtensionClasses;
}
}
diff --git a/Lombiq.HelpfulExtensions/Extensions/OrchardRecipeMigration/Navigation/AdminMenu.cs b/Lombiq.HelpfulExtensions/Extensions/OrchardRecipeMigration/Navigation/AdminMenu.cs
index c745bdc8..09e35021 100644
--- a/Lombiq.HelpfulExtensions/Extensions/OrchardRecipeMigration/Navigation/AdminMenu.cs
+++ b/Lombiq.HelpfulExtensions/Extensions/OrchardRecipeMigration/Navigation/AdminMenu.cs
@@ -23,8 +23,8 @@ public ValueTask BuildNavigationAsync(string name, NavigationBuilder builder)
{
if (!name.EqualsOrdinalIgnoreCase("admin")) return ValueTask.CompletedTask;
- builder.Add(T["Configuration"], configuration => configuration
- .Add(T["Import/Export"], importExport => importExport
+ builder.Add(T["Tools"], tools => tools
+ .Add(T["Deployments"], deployments => deployments
.Add(T["Orchard 1 Recipe Migration"], T["Orchard 1 Recipe Migration"], migration => migration
.Action(_hca.HttpContext, controller => controller.Index())
.LocalNav()
diff --git a/Lombiq.HelpfulExtensions/Extensions/OrchardRecipeMigration/Services/ListPartOrchardExportConverter.cs b/Lombiq.HelpfulExtensions/Extensions/OrchardRecipeMigration/Services/ListPartOrchardExportConverter.cs
index 602606bb..1e238418 100644
--- a/Lombiq.HelpfulExtensions/Extensions/OrchardRecipeMigration/Services/ListPartOrchardExportConverter.cs
+++ b/Lombiq.HelpfulExtensions/Extensions/OrchardRecipeMigration/Services/ListPartOrchardExportConverter.cs
@@ -18,18 +18,19 @@ public class ListPartOrchardExportConverter : IOrchardExportConverter
public Task UpdateContentItemsAsync(XDocument document, IList contentItems)
{
var itemsById = contentItems
- .Where(item => !string.IsNullOrEmpty(item.As()?.ExportId))
- .ToDictionary(item => item.As().ExportId);
+ .SelectWhere(
+ item => (Item: item, Ids: item.GetOrCreate()),
+ pair => !string.IsNullOrEmpty(pair.Ids.ExportId) && !string.IsNullOrEmpty(pair.Ids.Parent))
+ .ToDictionary(item => item.Ids.ExportId);
- foreach (var item in itemsById.Values.Where(item => !string.IsNullOrEmpty(item.As().Parent)))
+ foreach (var (item, ids) in itemsById.Values)
{
- var parentId = item.As().Parent;
- if (!itemsById.TryGetValue(parentId, out var parent) || !parent.Has()) continue;
+ if (!itemsById.TryGetValue(ids.Parent, out var parentPair) || !parentPair.Item.Has()) continue;
item.Alter(part =>
{
- part.ListContentItemId = parent.ContentItemId;
- part.ListContentType = parent.ContentType;
+ part.ListContentItemId = parentPair.Item.ContentItemId;
+ part.ListContentType = parentPair.Item.ContentType;
});
}
diff --git a/Lombiq.HelpfulExtensions/Extensions/OrchardRecipeMigration/Services/OrchardExportToRecipeConverter.cs b/Lombiq.HelpfulExtensions/Extensions/OrchardRecipeMigration/Services/OrchardExportToRecipeConverter.cs
index 0bf86640..c35e94a9 100644
--- a/Lombiq.HelpfulExtensions/Extensions/OrchardRecipeMigration/Services/OrchardExportToRecipeConverter.cs
+++ b/Lombiq.HelpfulExtensions/Extensions/OrchardRecipeMigration/Services/OrchardExportToRecipeConverter.cs
@@ -1,8 +1,7 @@
using Lombiq.HelpfulExtensions.Extensions.OrchardRecipeMigration.Controllers;
using Lombiq.HelpfulExtensions.Extensions.OrchardRecipeMigration.Models;
using Microsoft.AspNetCore.Mvc;
-using Microsoft.AspNetCore.Mvc.Infrastructure;
-using Microsoft.AspNetCore.Mvc.Routing;
+using OrchardCore;
using OrchardCore.ContentManagement;
using OrchardCore.ContentManagement.Metadata;
using OrchardCore.Entities;
@@ -21,30 +20,27 @@ public class OrchardExportToRecipeConverter : IOrchardExportToRecipeConverter
{
private readonly int batchSize = 50;
- private readonly IActionContextAccessor _actionContextAccessor;
private readonly IContentManager _contentManager;
private readonly IIdGenerator _idGenerator;
private readonly IEnumerable _contentConverters;
+ private readonly IOrchardHelper _orchardHelper;
private readonly IEnumerable _userConverters;
private readonly IContentDefinitionManager _contentDefinitionManager;
- private readonly IUrlHelperFactory _urlHelperFactory;
public OrchardExportToRecipeConverter(
- IActionContextAccessor actionContextAccessor,
IContentDefinitionManager contentDefinitionManager,
IContentManager contentManager,
IIdGenerator idGenerator,
IEnumerable contentConverters,
- IEnumerable userConverters,
- IUrlHelperFactory urlHelperFactory)
+ IOrchardHelper orchardHelper,
+ IEnumerable userConverters)
{
- _actionContextAccessor = actionContextAccessor;
_contentManager = contentManager;
_idGenerator = idGenerator;
_contentConverters = contentConverters;
+ _orchardHelper = orchardHelper;
_userConverters = userConverters;
_contentDefinitionManager = contentDefinitionManager;
- _urlHelperFactory = urlHelperFactory;
}
public async Task ConvertAsync(XDocument export, int page)
@@ -83,7 +79,7 @@ await _contentConverters
}
}
- var urlHelper = _urlHelperFactory.GetUrlHelper(_actionContextAccessor.ActionContext!);
+ var urlHelper = await _orchardHelper.GetUrlHelperAsync();
var hasNextPage = page < totalPages;
var nextUrl = hasNextPage ? urlHelper.Action(
diff --git a/Lombiq.HelpfulExtensions/Extensions/ShapeTracing/ShapeTracingShapeEvents.cs b/Lombiq.HelpfulExtensions/Extensions/ShapeTracing/ShapeTracingShapeEvents.cs
index 43d9873e..800af945 100644
--- a/Lombiq.HelpfulExtensions/Extensions/ShapeTracing/ShapeTracingShapeEvents.cs
+++ b/Lombiq.HelpfulExtensions/Extensions/ShapeTracing/ShapeTracingShapeEvents.cs
@@ -4,7 +4,6 @@
using Microsoft.Extensions.Logging;
using OrchardCore.DisplayManagement.Implementation;
using OrchardCore.DisplayManagement.Shapes;
-using System.Linq;
using System.Threading.Tasks;
namespace Lombiq.HelpfulExtensions.Extensions.ShapeTracing;
@@ -53,12 +52,6 @@ void AddIfNotNullOrEmpty(string name, string value)
builderShapeInfo.AppendHtmlLine(string.Join(", ", shapeMetadata.Alternates));
}
- if (shapeMetadata.BindingSources.Any())
- {
- builderShapeInfo.AppendHtml("Binding sources: ");
- builderShapeInfo.AppendHtmlLine(string.Join(", ", shapeMetadata.BindingSources));
- }
-
if (shapeMetadata.Wrappers.Count != 0)
{
builderShapeInfo.AppendHtml("Wrappers: ");
diff --git a/Lombiq.HelpfulExtensions/Extensions/SiteTexts/Services/ContentLocalizationSiteTextService.cs b/Lombiq.HelpfulExtensions/Extensions/SiteTexts/Services/ContentLocalizationSiteTextService.cs
index 18a24a14..41921357 100644
--- a/Lombiq.HelpfulExtensions/Extensions/SiteTexts/Services/ContentLocalizationSiteTextService.cs
+++ b/Lombiq.HelpfulExtensions/Extensions/SiteTexts/Services/ContentLocalizationSiteTextService.cs
@@ -25,10 +25,10 @@ public override async Task RenderHtmlByIdAsync(string contentItemId)
var part = await GetSiteTextMarkdownBodyPartByIdAsync(contentItemId);
var culture = CultureInfo.CurrentCulture.Name;
- if (part.As() is { Culture: { } partCulture, LocalizationSet: { } localizationSet } &&
+ if (part.GetMaybe() is { Culture: { } partCulture, LocalizationSet: { } localizationSet } &&
partCulture != culture &&
await _contentLocalizationManager.GetContentItemAsync(localizationSet, culture) is { } contentItem &&
- contentItem.As() is { } localizedPart)
+ contentItem.TryGet(out var localizedPart))
{
part = localizedPart;
}
diff --git a/Lombiq.HelpfulExtensions/Extensions/SiteTexts/Services/SiteTextServiceBase.cs b/Lombiq.HelpfulExtensions/Extensions/SiteTexts/Services/SiteTextServiceBase.cs
index 5e222bab..ec9172af 100644
--- a/Lombiq.HelpfulExtensions/Extensions/SiteTexts/Services/SiteTextServiceBase.cs
+++ b/Lombiq.HelpfulExtensions/Extensions/SiteTexts/Services/SiteTextServiceBase.cs
@@ -51,7 +51,7 @@ private async Task GetSiteTextMarkdownBodyPartByIdInnerAsync(s
throw new InvalidOperationException($"A content with the ID \"{contentItemId}\" does not exist.");
}
- if (contentItem.As() is not { } part)
+ if (!contentItem.TryGet(out var part))
{
throw new InvalidOperationException(
$"A content with the ID \"{contentItemId}\" does not have a {nameof(MarkdownBodyPart)}.");
diff --git a/Lombiq.HelpfulExtensions/Extensions/Widgets/Liquid/MenuWidgetLiquidFilter.cs b/Lombiq.HelpfulExtensions/Extensions/Widgets/Liquid/MenuWidgetLiquidFilter.cs
index 5f2e7c50..28ab8db2 100644
--- a/Lombiq.HelpfulExtensions/Extensions/Widgets/Liquid/MenuWidgetLiquidFilter.cs
+++ b/Lombiq.HelpfulExtensions/Extensions/Widgets/Liquid/MenuWidgetLiquidFilter.cs
@@ -3,9 +3,8 @@
using Lombiq.HelpfulExtensions.Extensions.Widgets.ViewModels;
using Lombiq.HelpfulLibraries.OrchardCore.Liquid;
using Microsoft.AspNetCore.Mvc;
-using Microsoft.AspNetCore.Mvc.Infrastructure;
-using Microsoft.AspNetCore.Mvc.Routing;
using Microsoft.Extensions.Localization;
+using OrchardCore;
using OrchardCore.Liquid;
using OrchardCore.Navigation;
using System;
@@ -21,24 +20,21 @@ namespace Lombiq.HelpfulExtensions.Extensions.Widgets.Liquid;
public class MenuWidgetLiquidFilter : ILiquidFilter
{
private readonly ILiquidContentDisplayService _liquidContentDisplayService;
- private readonly Lazy _urlHelperLazy;
+ private readonly IOrchardHelper _orchardHelper;
private readonly IStringLocalizer T;
public MenuWidgetLiquidFilter(
- IActionContextAccessor actionContextAccessor,
ILiquidContentDisplayService liquidContentDisplayService,
- IStringLocalizer stringLocalizer,
- IUrlHelperFactory urlHelperFactory)
+ IOrchardHelper orchardHelper,
+ IStringLocalizer stringLocalizer)
{
_liquidContentDisplayService = liquidContentDisplayService;
-
- _urlHelperLazy = new Lazy(() =>
- urlHelperFactory.GetUrlHelper(actionContextAccessor.ActionContext!));
+ _orchardHelper = orchardHelper;
T = stringLocalizer;
}
- public ValueTask ProcessAsync(FluidValue input, FilterArguments arguments, LiquidTemplateContext context)
+ public async ValueTask ProcessAsync(FluidValue input, FilterArguments arguments, LiquidTemplateContext context)
{
bool noWrapper, localNav;
string classes;
@@ -63,9 +59,10 @@ public ValueTask ProcessAsync(FluidValue input, FilterArguments argu
_ => null,
};
- UpdateMenuItems(menuItems, localNav);
+ var urlHelper = await _orchardHelper.GetUrlHelperAsync();
+ UpdateMenuItems(menuItems, localNav, urlHelper);
- return _liquidContentDisplayService.DisplayNewAsync(
+ return await _liquidContentDisplayService.DisplayNewAsync(
WidgetTypes.MenuWidget,
model =>
{
@@ -75,7 +72,7 @@ public ValueTask ProcessAsync(FluidValue input, FilterArguments argu
});
}
- private void UpdateMenuItems(IEnumerable