Skip to content

Commit

Permalink
Merge pull request #119 from Lombiq/issue/OSOE-867
Browse files Browse the repository at this point in the history
OSOE-867: Addressing analyzer warnings
  • Loading branch information
Piedone authored Jun 11, 2024
2 parents e283890 + e291d83 commit 2bd9952
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 6 deletions.
3 changes: 1 addition & 2 deletions Lombiq.BaseTheme/Attributes/DerivedThemeAttribute.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
using OrchardCore.ResourceManagement;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text.Json;

namespace Lombiq.BaseTheme.Attributes;
Expand All @@ -18,7 +17,7 @@ public sealed class DerivedThemeAttribute : ThemeAttribute
public string Favicon { get; set; }

public IEnumerable<LinkEntry> Links => LinksJson == null
? Enumerable.Empty<LinkEntry>()
? []
: JsonSerializer.Deserialize<IEnumerable<LinkEntry>>(LinksJson);

public DerivedThemeAttribute() =>
Expand Down
2 changes: 2 additions & 0 deletions Lombiq.BaseTheme/Controllers/AdminController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,8 @@ public async Task<IActionResult> Index()
[ValidateAntiForgeryToken]
public async Task<IActionResult> Update([FromForm] BaseThemeSettingsViewModel viewModel)
{
if (!ModelState.IsValid) return BadRequest(ModelState);

var siteSettings = await _siteService.LoadSiteSettingsAsync();
siteSettings.Alter<BaseThemeSettings>(nameof(BaseThemeSettings), settings =>
{
Expand Down
4 changes: 2 additions & 2 deletions Lombiq.BaseTheme/Permissions/BaseThemeSettingsPermissions.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using Lombiq.HelpfulLibraries.OrchardCore.Users;
using Lombiq.HelpfulLibraries.OrchardCore.Users;
using OrchardCore.Security.Permissions;
using System.Collections.Generic;

Expand All @@ -9,5 +9,5 @@ public class BaseThemeSettingsPermissions : AdminPermissionBase
public static readonly Permission ManageBaseThemeSettings =
new(nameof(ManageBaseThemeSettings), "Manage Lombiq.BaseTheme Settings.");

protected override IEnumerable<Permission> AdminPermissions => new[] { ManageBaseThemeSettings };
protected override IEnumerable<Permission> AdminPermissions => [ManageBaseThemeSettings];
}
5 changes: 3 additions & 2 deletions Lombiq.BaseTheme/ViewModels/BaseThemeSettingsViewModel.cs
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
using Microsoft.AspNetCore.Mvc.ModelBinding;
using Microsoft.AspNetCore.Mvc.ModelBinding;
using OrchardCore.DisplayManagement;

namespace Lombiq.BaseTheme.ViewModels;

public class BaseThemeSettingsViewModel
{
public string Icon { get; set; }
public bool HideMenu { get; set; }

public required bool HideMenu { get; set; }

[BindNever]
public IShape Editor { get; set; }
Expand Down

0 comments on commit 2bd9952

Please sign in to comment.