Skip to content

Commit

Permalink
Merge branch 'task/system-text-json-migration' into issue/OCC-245
Browse files Browse the repository at this point in the history
  • Loading branch information
sarahelsaig committed Jun 14, 2024
2 parents fc17d30 + 0dd3850 commit 9757e72
Show file tree
Hide file tree
Showing 7 changed files with 12 additions and 36 deletions.
13 changes: 0 additions & 13 deletions Lombiq.JsonEditor.Test.UI/License.md

This file was deleted.

3 changes: 1 addition & 2 deletions Lombiq.JsonEditor.Test.UI/Lombiq.JsonEditor.Tests.UI.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<PackageTags>OrchardCore;Lombiq;AspNetCore;JSONEditor</PackageTags>
<RepositoryUrl>https://github.com/Lombiq/Orchard-JSON-Editor</RepositoryUrl>
<PackageProjectUrl>https://github.com/Lombiq/Orchard-JSON-Editor/tree/dev/Lombiq.JSONEditor.Tests.UI</PackageProjectUrl>
<PackageLicenseFile>License.md</PackageLicenseFile>
<PackageLicenseExpression>BSD-3-Clause</PackageLicenseExpression>
</PropertyGroup>

<ItemGroup Condition="'$(NuGetBuild)' != 'true'">
Expand All @@ -25,7 +25,6 @@
</ItemGroup>

<ItemGroup>
<None Include="License.md" Pack="true" PackagePath="" />
<None Include="NuGetIcon.png" Pack="true" PackagePath="" />
<None Include="Readme.md" />
</ItemGroup>
Expand Down
4 changes: 4 additions & 0 deletions Lombiq.JsonEditor/Controllers/AdminController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,8 @@ public AdminController(
[Admin("Contents/ContentItems/{contentItemId}/Edit/Json")]
public async Task<IActionResult> Edit(string contentItemId)
{
if (!ModelState.IsValid) return BadRequest(ModelState);

if (string.IsNullOrWhiteSpace(contentItemId) ||
await _contentManager.GetAsync(contentItemId, VersionOptions.Latest) is not { } contentItem ||
!await CanEditAsync(contentItem))
Expand Down Expand Up @@ -95,6 +97,8 @@ public async Task<IActionResult> EditPost(
[Bind(Prefix = "submit.Publish")] string submitPublish,
[Bind(Prefix = "submit.Save")] string submitSave)
{
if (!ModelState.IsValid) return BadRequest(ModelState);

if (string.IsNullOrWhiteSpace(contentItemId) ||
string.IsNullOrWhiteSpace(json) ||
JsonSerializer.Deserialize<ContentItem>(json) is not { } contentItem)
Expand Down
13 changes: 0 additions & 13 deletions Lombiq.JsonEditor/License.md

This file was deleted.

3 changes: 1 addition & 2 deletions Lombiq.JsonEditor/Lombiq.JsonEditor.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,10 @@
<PackageTags>OrchardCore;Lombiq;AspNetCore;JSONEditor</PackageTags>
<RepositoryUrl>https://github.com/Lombiq/Orchard-JSON-Editor</RepositoryUrl>
<PackageProjectUrl>https://github.com/Lombiq/Orchard-JSON-Editor</PackageProjectUrl>
<PackageLicenseFile>License.md</PackageLicenseFile>
<PackageLicenseExpression>BSD-3-Clause</PackageLicenseExpression>
</PropertyGroup>

<ItemGroup>
<None Include="License.md" Pack="true" PackagePath="" />
<None Include="..\Readme.md" Link="Readme.md" />
<None Include="NuGetIcon.png" Pack="true" PackagePath="" />
</ItemGroup>
Expand Down
8 changes: 4 additions & 4 deletions Lombiq.JsonEditor/Models/JsonEditorOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public JsonEditorMode Mode
set => ModeString = GetModeString(value);
}

public IEnumerable<string> Modes { get; set; } = new[] { "tree", "view", "form", "code", "text", "preview" };
public IEnumerable<string> Modes { get; set; } = ["tree", "view", "form", "code", "text", "preview"];

/// <summary>
/// Gets or sets the JSON Schema to validate against. A JSON schema describes the structure that a JSON object must
Expand Down Expand Up @@ -117,8 +117,8 @@ private static string GetModeString(JsonEditorMode mode) =>
public static JsonEditorOptions GetSample(IHtmlLocalizer localizer) =>
new()
{
Templates = new[]
{
Templates =
[
new JsonEditorTemplate
{
Field = "aTechnicalNameThatHasToBeUnique",
Expand All @@ -128,6 +128,6 @@ public static JsonEditorOptions GetSample(IHtmlLocalizer localizer) =>
.Value,
Value = new { YourObject = "goes here" },
},
},
],
};
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using Lombiq.HelpfulLibraries.AspNetCore.Security;
using Lombiq.HelpfulLibraries.AspNetCore.Security;
using Lombiq.JsonEditor.Constants;
using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.DependencyInjection;
Expand All @@ -18,7 +18,7 @@ public class JsonEditorContentSecurityPolicyProvider : ResourceManagerContentSec
{
protected override string ResourceType => "script";
protected override string ResourceName => ResourceNames.Library;
protected override IReadOnlyCollection<string> DirectiveNameChain { get; } = new[] { WorkerSrc, ScriptSrc };
protected override IReadOnlyCollection<string> DirectiveNameChain { get; } = [WorkerSrc, ScriptSrc];
protected override string DirectiveValue => $"{Blob} {Data}";

protected override ValueTask ThenUpdateAsync(
Expand Down

0 comments on commit 9757e72

Please sign in to comment.