diff --git a/Lombiq.HelpfulExtensions.Tests.UI/Lombiq.HelpfulExtensions.Tests.UI.csproj b/Lombiq.HelpfulExtensions.Tests.UI/Lombiq.HelpfulExtensions.Tests.UI.csproj index 47b85a28..fbc9a14a 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 @@ - net6.0 + net8.0 $(DefaultItemExcludes);.git*;node_modules\** @@ -37,7 +37,7 @@ - + diff --git a/Lombiq.HelpfulExtensions/Controllers/OrchardRecipeMigrationAdminController.cs b/Lombiq.HelpfulExtensions/Controllers/OrchardRecipeMigrationAdminController.cs index 5858da19..b093f9e3 100644 --- a/Lombiq.HelpfulExtensions/Controllers/OrchardRecipeMigrationAdminController.cs +++ b/Lombiq.HelpfulExtensions/Controllers/OrchardRecipeMigrationAdminController.cs @@ -1,4 +1,4 @@ -using AngleSharp.Io; +using AngleSharp.Io; using Lombiq.HelpfulExtensions.Extensions.OrchardRecipeMigration.Services; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc; @@ -55,7 +55,7 @@ public async Task Convert(IFormFile file) json = await _converter.ConvertAsync(XDocument.Load(stream)); } - Response.Headers.Add("Content-Disposition", "attachment;filename=export.recipe.json"); + Response.Headers.Append("Content-Disposition", "attachment;filename=export.recipe.json"); return Content(json, MimeTypeNames.ApplicationJson, Encoding.UTF8); } } diff --git a/Lombiq.HelpfulExtensions/Extensions/ContentSets/Drivers/ContentSetContentPickerFieldDisplayDriver.cs b/Lombiq.HelpfulExtensions/Extensions/ContentSets/Drivers/ContentSetContentPickerFieldDisplayDriver.cs index 644cfa03..dfe278f0 100644 --- a/Lombiq.HelpfulExtensions/Extensions/ContentSets/Drivers/ContentSetContentPickerFieldDisplayDriver.cs +++ b/Lombiq.HelpfulExtensions/Extensions/ContentSets/Drivers/ContentSetContentPickerFieldDisplayDriver.cs @@ -1,10 +1,9 @@ -using Lombiq.HelpfulExtensions.Extensions.ContentSets.Events; +using Lombiq.HelpfulExtensions.Extensions.ContentSets.Events; using Lombiq.HelpfulExtensions.Extensions.ContentSets.Models; using Lombiq.HelpfulExtensions.Extensions.ContentSets.Services; using Lombiq.HelpfulExtensions.Extensions.ContentSets.ViewModels; using Lombiq.HelpfulLibraries.OrchardCore.Contents; using Microsoft.Extensions.Localization; -using Newtonsoft.Json.Linq; using OrchardCore.ContentManagement; using OrchardCore.ContentManagement.Display.ContentDisplay; using OrchardCore.ContentManagement.Display.Models; @@ -41,18 +40,18 @@ public override IDisplayResult Display( var name = fieldDisplayContext.PartFieldDefinition.Name; if (field.ContentItem.Get(name) is not { } part) return null; - return Initialize(GetDisplayShapeType(fieldDisplayContext), model => + return Initialize(GetDisplayShapeType(fieldDisplayContext), async model => { model.PartFieldDefinition = fieldDisplayContext.PartFieldDefinition; - return model.InitializeAsync( + await model.InitializeAsync( _contentSetManager, _contentSetEventHandlers, T, part, new ContentTypePartDefinition( name, - _contentDefinitionManager.GetPartDefinition(nameof(ContentSetPart)), - new JObject()), + await _contentDefinitionManager.GetPartDefinitionAsync(nameof(ContentSetPart)), + []), isNew: false); }) .Location(CommonContentDisplayTypes.Detail, CommonLocationNames.Content) diff --git a/Lombiq.HelpfulExtensions/Extensions/ContentSets/Indexes/ContentSetIndex.cs b/Lombiq.HelpfulExtensions/Extensions/ContentSets/Indexes/ContentSetIndex.cs index b03fe52b..7a89ff46 100644 --- a/Lombiq.HelpfulExtensions/Extensions/ContentSets/Indexes/ContentSetIndex.cs +++ b/Lombiq.HelpfulExtensions/Extensions/ContentSets/Indexes/ContentSetIndex.cs @@ -1,4 +1,4 @@ -using Lombiq.HelpfulExtensions.Extensions.ContentSets.Models; +using Lombiq.HelpfulExtensions.Extensions.ContentSets.Models; using Microsoft.Extensions.DependencyInjection; using OrchardCore.ContentManagement; using OrchardCore.ContentManagement.Metadata; @@ -37,15 +37,14 @@ public ContentSetIndexProvider(IServiceProvider provider) => _provider = provider; public override void Describe(DescribeContext context) => - context.For().Map(contentItem => + context.For().Map(async contentItem => { if (!contentItem.Latest) return Enumerable.Empty(); using var scope = _provider.CreateScope(); var contentDefinitionManager = scope.ServiceProvider.GetRequiredService(); - return contentDefinitionManager - .GetTypeDefinition(contentItem.ContentType) + return (await contentDefinitionManager.GetTypeDefinitionAsync(contentItem.ContentType)) .Parts .Where(part => part.PartDefinition.Name == nameof(ContentSetPart)) .Select(part => new { Part = contentItem.Get(part.Name), part.Name }) diff --git a/Lombiq.HelpfulExtensions/Extensions/ContentSets/Migrations.cs b/Lombiq.HelpfulExtensions/Extensions/ContentSets/Migrations.cs index 1c8364a7..46c3a4c4 100644 --- a/Lombiq.HelpfulExtensions/Extensions/ContentSets/Migrations.cs +++ b/Lombiq.HelpfulExtensions/Extensions/ContentSets/Migrations.cs @@ -1,9 +1,10 @@ -using Lombiq.HelpfulExtensions.Extensions.ContentSets.Indexes; +using Lombiq.HelpfulExtensions.Extensions.ContentSets.Indexes; using Lombiq.HelpfulExtensions.Extensions.ContentSets.Models; using Lombiq.HelpfulLibraries.OrchardCore.Data; using OrchardCore.ContentManagement.Metadata; using OrchardCore.ContentManagement.Metadata.Settings; using OrchardCore.Data.Migration; +using System.Threading.Tasks; using YesSql.Sql; namespace Lombiq.HelpfulExtensions.Extensions.ContentSets; @@ -15,14 +16,14 @@ public class Migrations : DataMigration public Migrations(IContentDefinitionManager contentDefinitionManager) => _contentDefinitionManager = contentDefinitionManager; - public int Create() + public async Task CreateAsync() { - _contentDefinitionManager.AlterPartDefinition(nameof(ContentSetPart), builder => builder + await _contentDefinitionManager.AlterPartDefinitionAsync(nameof(ContentSetPart), builder => builder .Attachable() .Reusable() .WithDisplayName("Content Set")); - SchemaBuilder.CreateMapIndexTable(table => table + await SchemaBuilder.CreateMapIndexTableAsync(table => table .Column(nameof(ContentSetIndex.ContentItemId), column => column.WithCommonUniqueIdLength()) .Column(nameof(ContentSetIndex.PartName)) .Column(nameof(ContentSetIndex.IsPublished)) diff --git a/Lombiq.HelpfulExtensions/Extensions/ContentSets/Models/ContentSetContentPickerField.cs b/Lombiq.HelpfulExtensions/Extensions/ContentSets/Models/ContentSetContentPickerField.cs index cc50fbeb..469f24ae 100644 --- a/Lombiq.HelpfulExtensions/Extensions/ContentSets/Models/ContentSetContentPickerField.cs +++ b/Lombiq.HelpfulExtensions/Extensions/ContentSets/Models/ContentSetContentPickerField.cs @@ -1,12 +1,7 @@ -using OrchardCore.ContentManagement; -using System.Diagnostics.CodeAnalysis; +using OrchardCore.ContentManagement; namespace Lombiq.HelpfulExtensions.Extensions.ContentSets.Models; -[SuppressMessage( - "Minor Code Smell", - "S2094:Classes should not be empty", - Justification = "Only data we need is the field name.")] public class ContentSetContentPickerField : ContentField { } diff --git a/Lombiq.HelpfulExtensions/Extensions/ContentSets/Services/ContentSetManager.cs b/Lombiq.HelpfulExtensions/Extensions/ContentSets/Services/ContentSetManager.cs index 5145175d..226bfa21 100644 --- a/Lombiq.HelpfulExtensions/Extensions/ContentSets/Services/ContentSetManager.cs +++ b/Lombiq.HelpfulExtensions/Extensions/ContentSets/Services/ContentSetManager.cs @@ -1,4 +1,4 @@ -using Lombiq.HelpfulExtensions.Extensions.ContentSets.Events; +using Lombiq.HelpfulExtensions.Extensions.ContentSets.Events; using Lombiq.HelpfulExtensions.Extensions.ContentSets.Indexes; using Lombiq.HelpfulExtensions.Extensions.ContentSets.Models; using OrchardCore.ContentManagement; @@ -58,8 +58,7 @@ await _contentManager.CloneAsync(original) is not { } content) part.Key = newKey; }); - var contentTypePartDefinition = _contentDefinitionManager - .GetTypeDefinition(content.ContentType) + var contentTypePartDefinition = (await _contentDefinitionManager.GetTypeDefinitionAsync(content.ContentType)) .Parts .Single(definition => definition.Name == fromPartName); diff --git a/Lombiq.HelpfulExtensions/Extensions/ContentTypes/Migrations.cs b/Lombiq.HelpfulExtensions/Extensions/ContentTypes/Migrations.cs index e07f5708..946d2380 100644 --- a/Lombiq.HelpfulExtensions/Extensions/ContentTypes/Migrations.cs +++ b/Lombiq.HelpfulExtensions/Extensions/ContentTypes/Migrations.cs @@ -2,6 +2,7 @@ using OrchardCore.ContentManagement.Metadata; using OrchardCore.ContentManagement.Metadata.Settings; using OrchardCore.Data.Migration; +using System.Threading.Tasks; using static Lombiq.HelpfulExtensions.Extensions.ContentTypes.ContentTypes; namespace Lombiq.HelpfulExtensions.Extensions.ContentTypes; @@ -13,9 +14,9 @@ public class Migrations : DataMigration public Migrations(IContentDefinitionManager contentDefinitionManager) => _contentDefinitionManager = contentDefinitionManager; - public int Create() + public async Task CreateAsync() { - _contentDefinitionManager.AlterTypeDefinition(Page, builder => builder + await _contentDefinitionManager.AlterTypeDefinitionAsync(Page, builder => builder .Creatable() .Securable() .Draftable() @@ -33,16 +34,16 @@ public int Create() .WithPart("FlowPart", part => part.WithPosition("2")) ); - _contentDefinitionManager.AlterTypeDefinition(Empty, builder => builder + await _contentDefinitionManager.AlterTypeDefinitionAsync(Empty, builder => builder .WithDescription("A base content type for ad-hoc welding parts or fields on.") ); return 3; } - public int UpdateFrom1() + public async Task UpdateFrom1Async() { - _contentDefinitionManager.AlterTypeDefinition(Page, builder => builder + await _contentDefinitionManager.AlterTypeDefinitionAsync(Page, builder => builder .WithPart("TitlePart", part => part.WithPosition("0")) .WithPart("AutoroutePart", part => part.WithPosition("1")) .WithPart("FlowPart", part => part.WithPosition("2")) @@ -51,9 +52,9 @@ public int UpdateFrom1() return 2; } - public int UpdateFrom2() + public async Task UpdateFrom2Async() { - _contentDefinitionManager.AlterTypeDefinition(Empty, builder => builder + await _contentDefinitionManager.AlterTypeDefinitionAsync(Empty, builder => builder .WithDescription("A base content type for ad-hoc welding parts or fields on.") ); diff --git a/Lombiq.HelpfulExtensions/Extensions/Flows/Handlers/AdditionalStylingPartHandler.cs b/Lombiq.HelpfulExtensions/Extensions/Flows/Handlers/AdditionalStylingPartHandler.cs index 8b43e9a3..8fa611b0 100644 --- a/Lombiq.HelpfulExtensions/Extensions/Flows/Handlers/AdditionalStylingPartHandler.cs +++ b/Lombiq.HelpfulExtensions/Extensions/Flows/Handlers/AdditionalStylingPartHandler.cs @@ -14,15 +14,13 @@ public class AdditionalStylingPartHandler : ContentHandlerBase public AdditionalStylingPartHandler(IContentDefinitionManager contentDefinitionManager) => _contentDefinitionManager = contentDefinitionManager; - public override Task ActivatedAsync(ActivatedContentContext context) + public override async Task ActivatedAsync(ActivatedContentContext context) { if (!context.ContentItem.Has() && - _contentDefinitionManager.GetTypeDefinition(context.ContentItem.ContentType) + (await _contentDefinitionManager.GetTypeDefinitionAsync(context.ContentItem.ContentType)) .GetSettings().Stereotype == "Widget") { context.ContentItem.Weld(); } - - return Task.CompletedTask; } } diff --git a/Lombiq.HelpfulExtensions/Extensions/OrchardRecipeMigration/Navigation/AdminMenu.cs b/Lombiq.HelpfulExtensions/Extensions/OrchardRecipeMigration/Navigation/AdminMenu.cs index 622ca6b7..3ada4e8a 100644 --- a/Lombiq.HelpfulExtensions/Extensions/OrchardRecipeMigration/Navigation/AdminMenu.cs +++ b/Lombiq.HelpfulExtensions/Extensions/OrchardRecipeMigration/Navigation/AdminMenu.cs @@ -1,9 +1,9 @@ -using Lombiq.HelpfulExtensions.Extensions.OrchardRecipeMigration.Controllers; +using Lombiq.HelpfulExtensions.Extensions.OrchardRecipeMigration.Controllers; using Lombiq.HelpfulLibraries.OrchardCore.Navigation; using Microsoft.AspNetCore.Http; using Microsoft.Extensions.Localization; +using OrchardCore.Modules; using OrchardCore.Navigation; -using System; using System.Threading.Tasks; namespace Lombiq.HelpfulExtensions.Extensions.OrchardRecipeMigration.Navigation; diff --git a/Lombiq.HelpfulExtensions/Extensions/OrchardRecipeMigration/Services/OrchardExportToRecipeConverter.cs b/Lombiq.HelpfulExtensions/Extensions/OrchardRecipeMigration/Services/OrchardExportToRecipeConverter.cs index 8d3c669b..5eddadb5 100644 --- a/Lombiq.HelpfulExtensions/Extensions/OrchardRecipeMigration/Services/OrchardExportToRecipeConverter.cs +++ b/Lombiq.HelpfulExtensions/Extensions/OrchardRecipeMigration/Services/OrchardExportToRecipeConverter.cs @@ -19,8 +19,7 @@ public class OrchardExportToRecipeConverter : IOrchardExportToRecipeConverter private readonly IEnumerable _exportConverters; private readonly IEnumerable _contentConverters; private readonly IEnumerable _userConverters; - - private readonly ICollection _contentTypes; + private readonly IContentDefinitionManager _contentDefinitionManager; public OrchardExportToRecipeConverter( IContentDefinitionManager contentDefinitionManager, @@ -35,21 +34,20 @@ public OrchardExportToRecipeConverter( _exportConverters = exportConverters; _contentConverters = contentConverters; _userConverters = userConverters; - - _contentTypes = contentDefinitionManager - .ListTypeDefinitions() - .Select(definition => definition.Name) - .ToList(); + _contentDefinitionManager = contentDefinitionManager; } public async Task ConvertAsync(XDocument export) { var contentItems = new List(); var contents = export.XPathSelectElement("//Content")?.Elements() ?? Enumerable.Empty(); + var contentTypes = (await _contentDefinitionManager.ListTypeDefinitionsAsync()) + .Select(definition => definition.Name) + .ToList(); foreach (var content in contents) { - if (await CreateContentItemAsync(content) is { } contentItem) + if (await CreateContentItemAsync(content, contentTypes) is { } contentItem) { contentItem.ContentItemId ??= _idGenerator.GenerateUniqueId(); contentItem.ContentItemVersionId ??= _idGenerator.GenerateUniqueId(); @@ -80,7 +78,7 @@ await _contentConverters return recipe.ToString(); } - private async Task CreateContentItemAsync(XElement content) + private async Task CreateContentItemAsync(XElement content, List contentTypes) { foreach (var converter in _contentConverters.OrderBy(converter => converter.Order)) { @@ -90,7 +88,7 @@ private async Task CreateContentItemAsync(XElement content) } } - return _contentTypes.Contains(content.Name.LocalName) + return contentTypes.Contains(content.Name.LocalName) ? await _contentManager.NewAsync(content.Name.LocalName) : null; } diff --git a/Lombiq.HelpfulExtensions/Extensions/OrchardRecipeMigration/Services/UserOrchardContentConverter.cs b/Lombiq.HelpfulExtensions/Extensions/OrchardRecipeMigration/Services/UserOrchardContentConverter.cs index 40533b6f..522e7970 100644 --- a/Lombiq.HelpfulExtensions/Extensions/OrchardRecipeMigration/Services/UserOrchardContentConverter.cs +++ b/Lombiq.HelpfulExtensions/Extensions/OrchardRecipeMigration/Services/UserOrchardContentConverter.cs @@ -2,7 +2,6 @@ using OrchardCore.Users.Models; using OrchardCore.Users.Services; using System.Collections.Generic; -using System.Linq; using System.Threading.Tasks; using System.Xml.Linq; using static Lombiq.HelpfulLibraries.OrchardCore.Users.PasswordHelper; @@ -30,7 +29,7 @@ public async Task ImportAsync(XElement element) return; var roles = element.Element("UserRolesPart").Attribute("Roles")?.Value; - var rolesList = string.IsNullOrEmpty(roles) ? new List() : roles.Split(',').ToList(); + var rolesList = string.IsNullOrEmpty(roles) ? new List() : [.. roles.Split(',')]; await _userService.CreateUserAsync( new User diff --git a/Lombiq.HelpfulExtensions/Extensions/Security/Services/StrictSecurityPermissionAuthorizationHandler.cs b/Lombiq.HelpfulExtensions/Extensions/Security/Services/StrictSecurityPermissionAuthorizationHandler.cs index 97af29b4..f61d44db 100644 --- a/Lombiq.HelpfulExtensions/Extensions/Security/Services/StrictSecurityPermissionAuthorizationHandler.cs +++ b/Lombiq.HelpfulExtensions/Extensions/Security/Services/StrictSecurityPermissionAuthorizationHandler.cs @@ -27,20 +27,20 @@ public class StrictSecurityPermissionAuthorizationHandler : AuthorizationHandler public StrictSecurityPermissionAuthorizationHandler(IContentDefinitionManager contentDefinitionManager) => _contentDefinitionManager = contentDefinitionManager; - protected override Task HandleRequirementAsync(AuthorizationHandlerContext context, PermissionRequirement requirement) + protected override async Task HandleRequirementAsync(AuthorizationHandlerContext context, PermissionRequirement requirement) { if ((context.Resource as IContent)?.ContentItem is not { } contentItem || !_permissionTemplates.TryGetValue(requirement.Permission.Name, out var claims) || - _contentDefinitionManager.GetTypeDefinition(contentItem.ContentType) is not { } definition || + await _contentDefinitionManager.GetTypeDefinitionAsync(contentItem.ContentType) is not { } definition || definition.GetSettings()?.Enabled != true) { - return Task.CompletedTask; + return; } if (!context.User.Identity.IsAuthenticated) { context.Fail(); - return Task.CompletedTask; + return; } var contentType = contentItem.ContentType; @@ -54,7 +54,6 @@ protected override Task HandleRequirementAsync(AuthorizationHandlerContext conte .Select(claim => claim.Value); if (!permissionNames.Any(claims.Contains)) context.Fail(); - return Task.CompletedTask; } private static IList GetPermissionTemplates(Permission permission, IList templates) diff --git a/Lombiq.HelpfulExtensions/Extensions/ShapeTracing/ShapeTracingShapeEvents.cs b/Lombiq.HelpfulExtensions/Extensions/ShapeTracing/ShapeTracingShapeEvents.cs index bb4271b9..c9fae732 100644 --- a/Lombiq.HelpfulExtensions/Extensions/ShapeTracing/ShapeTracingShapeEvents.cs +++ b/Lombiq.HelpfulExtensions/Extensions/ShapeTracing/ShapeTracingShapeEvents.cs @@ -37,7 +37,7 @@ void AddIfNotNullOrEmpty(string name, string value) } } - if (shapeMetadata.Alternates.Any()) + if (shapeMetadata.Alternates.Count != 0) { builder.AppendHtml("Alternates: "); builder.AppendHtmlLine(string.Join(", ", shapeMetadata.Alternates)); @@ -49,7 +49,7 @@ void AddIfNotNullOrEmpty(string name, string value) builder.AppendHtmlLine(string.Join(", ", shapeMetadata.BindingSources)); } - if (shapeMetadata.Wrappers.Any()) + if (shapeMetadata.Wrappers.Count != 0) { builder.AppendHtml("Wrappers: "); builder.AppendHtmlLine(string.Join(", ", shapeMetadata.Wrappers)); diff --git a/Lombiq.HelpfulExtensions/Extensions/SiteTexts/LocalizationMigrations.cs b/Lombiq.HelpfulExtensions/Extensions/SiteTexts/LocalizationMigrations.cs index 84a47879..f52bdd82 100644 --- a/Lombiq.HelpfulExtensions/Extensions/SiteTexts/LocalizationMigrations.cs +++ b/Lombiq.HelpfulExtensions/Extensions/SiteTexts/LocalizationMigrations.cs @@ -1,6 +1,7 @@ -using OrchardCore.ContentLocalization.Models; +using OrchardCore.ContentLocalization.Models; using OrchardCore.ContentManagement.Metadata; using OrchardCore.Data.Migration; +using System.Threading.Tasks; using static Lombiq.HelpfulExtensions.Extensions.SiteTexts.Constants.ContentTypes; namespace Lombiq.HelpfulExtensions.Extensions.SiteTexts; @@ -12,9 +13,9 @@ public class LocalizationMigrations : DataMigration public LocalizationMigrations(IContentDefinitionManager contentDefinitionManager) => _contentDefinitionManager = contentDefinitionManager; - public int Create() + public async Task CreateAsync() { - _contentDefinitionManager.AlterTypeDefinition(SiteText, builder => builder + await _contentDefinitionManager.AlterTypeDefinitionAsync(SiteText, builder => builder .WithPart(nameof(LocalizationPart))); return 1; diff --git a/Lombiq.HelpfulExtensions/Extensions/SiteTexts/Services/SiteTextServiceBase.cs b/Lombiq.HelpfulExtensions/Extensions/SiteTexts/Services/SiteTextServiceBase.cs index d9e5f902..5e222bab 100644 --- a/Lombiq.HelpfulExtensions/Extensions/SiteTexts/Services/SiteTextServiceBase.cs +++ b/Lombiq.HelpfulExtensions/Extensions/SiteTexts/Services/SiteTextServiceBase.cs @@ -36,7 +36,7 @@ protected async Task RenderMarkdownAsync(string markdown) // If it's a single-line expression, then it's presumably inline so don't wrap it in a

element. if (doc.Body is { ChildElementCount: 1, FirstElementChild: { } first } && - first.TagName.ToUpperInvariant() == "P") + first.TagName.EqualsOrdinalIgnoreCase("P")) { html = first.InnerHtml.Trim(); } diff --git a/Lombiq.HelpfulExtensions/Extensions/SiteTexts/SiteTextMigrations.cs b/Lombiq.HelpfulExtensions/Extensions/SiteTexts/SiteTextMigrations.cs index 4a3f9d32..b7fb7ffe 100644 --- a/Lombiq.HelpfulExtensions/Extensions/SiteTexts/SiteTextMigrations.cs +++ b/Lombiq.HelpfulExtensions/Extensions/SiteTexts/SiteTextMigrations.cs @@ -1,9 +1,10 @@ -using OrchardCore.ContentLocalization.Models; +using OrchardCore.ContentLocalization.Models; using OrchardCore.ContentManagement.Metadata; using OrchardCore.ContentManagement.Metadata.Builders; using OrchardCore.ContentManagement.Metadata.Settings; using OrchardCore.Data.Migration; using OrchardCore.Markdown.Models; +using System.Threading.Tasks; using static Lombiq.HelpfulExtensions.Extensions.SiteTexts.Constants.ContentTypes; using static Lombiq.HelpfulLibraries.OrchardCore.Contents.ContentFieldEditorEnums; @@ -16,9 +17,9 @@ public class SiteTextMigrations : DataMigration public SiteTextMigrations(IContentDefinitionManager contentDefinitionManager) => _contentDefinitionManager = contentDefinitionManager; - public int Create() + public async Task CreateAsync() { - _contentDefinitionManager.AlterTypeDefinition(SiteText, builder => builder + await _contentDefinitionManager.AlterTypeDefinitionAsync(SiteText, builder => builder .SetAbilities( creatable: true, securable: true, diff --git a/Lombiq.HelpfulExtensions/Extensions/Widgets/Drivers/MvcConditionEvaluatorDriver.cs b/Lombiq.HelpfulExtensions/Extensions/Widgets/Drivers/MvcConditionEvaluatorDriver.cs index 1eff2d27..7a29c2c1 100644 --- a/Lombiq.HelpfulExtensions/Extensions/Widgets/Drivers/MvcConditionEvaluatorDriver.cs +++ b/Lombiq.HelpfulExtensions/Extensions/Widgets/Drivers/MvcConditionEvaluatorDriver.cs @@ -1,8 +1,8 @@ -using Lombiq.HelpfulExtensions.Extensions.Widgets.Models; +using Lombiq.HelpfulExtensions.Extensions.Widgets.Models; using Microsoft.AspNetCore.Http; using OrchardCore.ContentManagement.Display.ContentDisplay; +using OrchardCore.Modules; using OrchardCore.Rules; -using System; using System.Linq; using System.Threading.Tasks; diff --git a/Lombiq.HelpfulExtensions/Extensions/Widgets/Migrations.cs b/Lombiq.HelpfulExtensions/Extensions/Widgets/Migrations.cs index 9425ebee..00147782 100644 --- a/Lombiq.HelpfulExtensions/Extensions/Widgets/Migrations.cs +++ b/Lombiq.HelpfulExtensions/Extensions/Widgets/Migrations.cs @@ -4,6 +4,7 @@ using OrchardCore.ContentManagement.Metadata; using OrchardCore.ContentManagement.Metadata.Settings; using OrchardCore.Data.Migration; +using System.Threading.Tasks; using static Lombiq.HelpfulExtensions.Extensions.Widgets.WidgetTypes; namespace Lombiq.HelpfulExtensions.Extensions.Widgets; @@ -15,16 +16,16 @@ public class Migrations : DataMigration public Migrations(IContentDefinitionManager contentDefinitionManager) => _contentDefinitionManager = contentDefinitionManager; - public int Create() + public async Task CreateAsync() { - _contentDefinitionManager.AlterTypeDefinition(ContainerWidget, builder => builder + await _contentDefinitionManager.AlterTypeDefinitionAsync(ContainerWidget, builder => builder .Securable() .Stereotype(CommonStereotypes.Widget) .WithPart("TitlePart", part => part.WithPosition("0")) .WithPart("FlowPart", part => part.WithPosition("1")) ); - _contentDefinitionManager.AlterTypeDefinition(HtmlWidget, builder => builder + await _contentDefinitionManager.AlterTypeDefinitionAsync(HtmlWidget, builder => builder .Securable() .Stereotype(CommonStereotypes.Widget) .WithPart("HtmlBodyPart", part => part @@ -36,7 +37,7 @@ public int Create() ) ); - _contentDefinitionManager.AlterTypeDefinition(LiquidWidget, builder => builder + await _contentDefinitionManager.AlterTypeDefinitionAsync(LiquidWidget, builder => builder .Securable() .Stereotype(CommonStereotypes.Widget) .WithPart("LiquidPart", part => part @@ -44,12 +45,12 @@ public int Create() ) ); - _contentDefinitionManager.AlterTypeDefinition(MenuWidget, builder => builder + await _contentDefinitionManager.AlterTypeDefinitionAsync(MenuWidget, builder => builder .Securable() .Stereotype(CommonStereotypes.Widget) ); - _contentDefinitionManager.AlterTypeDefinition(MarkdownWidget, builder => builder + await _contentDefinitionManager.AlterTypeDefinitionAsync(MarkdownWidget, builder => builder .Securable() .Stereotype(CommonStereotypes.Widget) .WithPart("MarkdownBodyPart", part => part @@ -57,7 +58,7 @@ public int Create() ) ); - var contentItemWidgetPartName = _contentDefinitionManager.AlterPartDefinition(builder => builder + var contentItemWidgetPartName = await _contentDefinitionManager.AlterPartDefinitionAsync(builder => builder .WithField(part => part.ContentToDisplay, field => field .WithDisplayName("Content to display") .WithSettings(new ContentPickerFieldSettings @@ -69,7 +70,7 @@ public int Create() .WithField(part => part.GroupId, field => field.WithDisplayName("Group ID")) ); - _contentDefinitionManager.AlterTypeDefinition(WidgetTypes.ContentItemWidget, builder => builder + await _contentDefinitionManager.AlterTypeDefinitionAsync(WidgetTypes.ContentItemWidget, builder => builder .Securable() .Stereotype(CommonStereotypes.Widget) .WithPart(contentItemWidgetPartName) @@ -78,9 +79,9 @@ public int Create() return 5; } - public int UpdateFrom1() + public async Task UpdateFrom1Async() { - _contentDefinitionManager.AlterTypeDefinition(ContainerWidget, builder => builder + await _contentDefinitionManager.AlterTypeDefinitionAsync(ContainerWidget, builder => builder .WithPart("TitlePart", part => part.WithPosition("0")) .WithPart("FlowPart", part => part.WithPosition("1")) ); @@ -88,9 +89,9 @@ public int UpdateFrom1() return 2; } - public int UpdateFrom2() + public async Task UpdateFrom2Async() { - _contentDefinitionManager.AlterTypeDefinition(MenuWidget, builder => builder + await _contentDefinitionManager.AlterTypeDefinitionAsync(MenuWidget, builder => builder .Securable() .Stereotype(CommonStereotypes.Widget) ); @@ -98,9 +99,9 @@ public int UpdateFrom2() return 3; } - public int UpdateFrom3() + public async Task UpdateFrom3Async() { - _contentDefinitionManager.AlterTypeDefinition(MarkdownWidget, builder => builder + await _contentDefinitionManager.AlterTypeDefinitionAsync(MarkdownWidget, builder => builder .Securable() .Stereotype(CommonStereotypes.Widget) .WithPart("MarkdownBodyPart", part => part @@ -111,15 +112,15 @@ public int UpdateFrom3() return 4; } - public int UpdateFrom4() + public async Task UpdateFrom4Async() { - var contentItemWidgetPartName = _contentDefinitionManager.AlterPartDefinition(builder => builder + var contentItemWidgetPartName = await _contentDefinitionManager.AlterPartDefinitionAsync(builder => builder .WithField(part => part.ContentToDisplay, field => field.WithDisplayName("Content to display")) .WithField(part => part.DisplayType, field => field.WithDisplayName("Display type")) .WithField(part => part.GroupId, field => field.WithDisplayName("Group ID")) ); - _contentDefinitionManager.AlterTypeDefinition(WidgetTypes.ContentItemWidget, builder => builder + await _contentDefinitionManager.AlterTypeDefinitionAsync(WidgetTypes.ContentItemWidget, builder => builder .Securable() .Stereotype(CommonStereotypes.Widget) .WithPart(contentItemWidgetPartName) diff --git a/Lombiq.HelpfulExtensions/Lombiq.HelpfulExtensions.csproj b/Lombiq.HelpfulExtensions/Lombiq.HelpfulExtensions.csproj index 53028f47..5224bdce 100644 --- a/Lombiq.HelpfulExtensions/Lombiq.HelpfulExtensions.csproj +++ b/Lombiq.HelpfulExtensions/Lombiq.HelpfulExtensions.csproj @@ -3,7 +3,7 @@ - net6.0 + net8.0 true $(DefaultItemExcludes);.git*;node_modules\** @@ -36,18 +36,19 @@ - - - - - - - - - - - - + + + + + + + + + + + + + @@ -56,8 +57,8 @@ - - + + diff --git a/Lombiq.HelpfulExtensions/Manifest.cs b/Lombiq.HelpfulExtensions/Manifest.cs index 320f3350..29ff8210 100644 --- a/Lombiq.HelpfulExtensions/Manifest.cs +++ b/Lombiq.HelpfulExtensions/Manifest.cs @@ -13,10 +13,10 @@ Name = "Lombiq Helpful Extensions - Code Generation Helpful Extensions", Category = "Development", Description = "Generates migrations from content type definitions.", - Dependencies = new[] - { + Dependencies = + [ "OrchardCore.Resources", - } + ] )] [assembly: Feature( @@ -24,10 +24,10 @@ Name = "Lombiq Helpful Extensions - Content Sets", Category = "Development", Description = "Create arbitrary collections of content items.", - Dependencies = new[] - { + Dependencies = + [ "OrchardCore.ContentManagement", - } + ] )] [assembly: Feature( @@ -35,10 +35,10 @@ Name = "Lombiq Helpful Extensions - Flows Helpful Extensions", Category = "Content", Description = "Adds additional styling capabilities to Flow Part.", - Dependencies = new[] - { + Dependencies = + [ "OrchardCore.Flows", - } + ] )] [assembly: Feature( @@ -46,12 +46,12 @@ Name = "Lombiq Helpful Extensions - Helpful Widgets", Category = "Content", Description = "Adds helpful widgets such as Container or Liquid widgets.", - Dependencies = new[] - { + Dependencies = + [ "OrchardCore.Html", "OrchardCore.Liquid", "OrchardCore.Title", - } + ] )] [assembly: Feature( @@ -59,12 +59,12 @@ Name = "Lombiq Helpful Extensions - Helpful Content Types", Category = "Content", Description = "Adds helpful content types such as Page.", - Dependencies = new[] - { + Dependencies = + [ "OrchardCore.Autoroute", "OrchardCore.Flows", "OrchardCore.Title", - } + ] )] [assembly: Feature( @@ -86,10 +86,10 @@ Name = "Lombiq Helpful Extensions - Emails", Category = "Messaging", Description = "Adds shape-based email template rendering and helpful email sending services.", - Dependencies = new[] - { + Dependencies = + [ "OrchardCore.Email", - } + ] )] [assembly: Feature( @@ -107,10 +107,10 @@ "Adds a content type that lets the users with admin dashboard access customize string/HTML resources on the " + "site via Markdown. If OrchardCore.ContentLocalization is enabled, it also tries to retrieve the localized " + "version if available.", - Dependencies = new[] - { + Dependencies = + [ "OrchardCore.Markdown", - } + ] )] [assembly: Feature( @@ -121,10 +121,10 @@ "Convert Orchard 1's export XML files into Orchard Core recipes. This feature contains the basics like " + "CommonPart and BodyPart (full list is in the Helpful Extensions repository readme), but can be extended " + "with additional converters that only have to handle more specialized export data.", - Dependencies = new[] - { + Dependencies = + [ "OrchardCore.Contents", - } + ] )] [assembly: Feature( @@ -132,11 +132,11 @@ Name = "Lombiq Helpful Extensions - Reset password workflow activity", Category = "Security", Description = "Adds generate reset password token activity.", - Dependencies = new[] - { + Dependencies = + [ "OrchardCore.Users.ResetPassword", "OrchardCore.Workflows", - } + ] )] [assembly: Feature( diff --git a/Lombiq.HelpfulExtensions/Views/AdditionalStylingPart.Edit.cshtml b/Lombiq.HelpfulExtensions/Views/AdditionalStylingPart.Edit.cshtml index 44a280ee..bbfe0b77 100644 --- a/Lombiq.HelpfulExtensions/Views/AdditionalStylingPart.Edit.cshtml +++ b/Lombiq.HelpfulExtensions/Views/AdditionalStylingPart.Edit.cshtml @@ -6,12 +6,12 @@

diff --git a/Lombiq.HelpfulExtensions/Views/ContentSetPart.Edit.cshtml b/Lombiq.HelpfulExtensions/Views/ContentSetPart.Edit.cshtml index 9fb2805b..b2d10c57 100644 --- a/Lombiq.HelpfulExtensions/Views/ContentSetPart.Edit.cshtml +++ b/Lombiq.HelpfulExtensions/Views/ContentSetPart.Edit.cshtml @@ -1,4 +1,4 @@ -@model Lombiq.HelpfulExtensions.Extensions.ContentSets.ViewModels.ContentSetPartViewModel +@model Lombiq.HelpfulExtensions.Extensions.ContentSets.ViewModels.ContentSetPartViewModel

@T["Information about the \"{0}\" content set part.", Model.Definition.Name]

@@ -7,7 +7,7 @@ @if (!Model.IsNew) {
- +
    @foreach (var link in Model.MemberLinks) { diff --git a/Lombiq.HelpfulExtensions/Views/Items/GenerateResetPasswordTokenTask.Fields.Edit.cshtml b/Lombiq.HelpfulExtensions/Views/Items/GenerateResetPasswordTokenTask.Fields.Edit.cshtml index 862a0857..6f8ac589 100644 --- a/Lombiq.HelpfulExtensions/Views/Items/GenerateResetPasswordTokenTask.Fields.Edit.cshtml +++ b/Lombiq.HelpfulExtensions/Views/Items/GenerateResetPasswordTokenTask.Fields.Edit.cshtml @@ -1,19 +1,19 @@ @model Lombiq.HelpfulExtensions.Extensions.Workflows.ViewModels.GenerateResetPasswordTokenTaskViewModel
    - + @T["Enter a JavaScript expression that evaluates to the User object."]
    - + @T["Optional key of the property in the Workflow context where this Task will set the reset password token to."]
    - + @T["Optional key of the property in the Workflow context where this Task will set the reset password URL to."] diff --git a/Lombiq.HelpfulExtensions/Views/MvcCondition.Fields.Edit.cshtml b/Lombiq.HelpfulExtensions/Views/MvcCondition.Fields.Edit.cshtml index bbf2dfc4..f75783b8 100644 --- a/Lombiq.HelpfulExtensions/Views/MvcCondition.Fields.Edit.cshtml +++ b/Lombiq.HelpfulExtensions/Views/MvcCondition.Fields.Edit.cshtml @@ -17,7 +17,7 @@
    - + \ No newline at end of file +