Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Taxonomy Serialization #15615

Merged
merged 3 commits into from
Mar 28, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
using System.Linq;
using System.Text.Json;
using System.Text.Json.Nodes;
using System.Text.Json.Settings;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.Localization;
using Microsoft.Extensions.Options;
using OrchardCore.Admin;
using OrchardCore.ContentManagement;
using OrchardCore.ContentManagement.Display;
Expand Down Expand Up @@ -321,7 +319,10 @@ public async Task<IActionResult> Delete(string taxonomyContentItemId, string tax
return NotFound();
}

taxonomy.As<TaxonomyPart>().Content.Remove(taxonomyItemId);
taxonomy.Alter<TaxonomyPart>(part =>
{
part.Terms = part.Terms.Where(x => x.ContentItemId != taxonomyItemId).ToList();
});

await _session.SaveAsync(taxonomy);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,12 @@ public override ContentItem Read(ref Utf8JsonReader reader, Type typeToConvert,
if (reader.TokenType == JsonTokenType.StartObject)
{
var property = JNode.Load(ref reader);
contentItem.Data.Add(propertyName, property);
contentItem.Data[propertyName] = property;
}
else if (reader.TokenType == JsonTokenType.StartArray)
{
var property = JNode.Load(ref reader);
contentItem.Data[propertyName] = property;
}

break;
Expand Down
Loading