mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-08-01 17:25:05 +08:00
#20002: Fixing lost terms after a taxonomy title is changed
Term type is no more changed as a content item can't have his type changed. Users can still update the term type display name. Work Item: 20002
This commit is contained in:
parent
b7efeb457c
commit
78087005c5
@ -22,12 +22,15 @@ namespace Orchard.Taxonomies.Handlers {
|
|||||||
Filters.Add(StorageFilter.For(repository));
|
Filters.Add(StorageFilter.For(repository));
|
||||||
OnPublished<TaxonomyPart>((context, part) => {
|
OnPublished<TaxonomyPart>((context, part) => {
|
||||||
var previousTermTypeName = part.TermTypeName;
|
var previousTermTypeName = part.TermTypeName;
|
||||||
|
|
||||||
|
if (previousName == null || part.Name == previousName) {
|
||||||
|
// is it a new taxonomy ?
|
||||||
taxonomyService.CreateTermContentType(part);
|
taxonomyService.CreateTermContentType(part);
|
||||||
|
}
|
||||||
if (previousName != null && part.Name != previousName) {
|
else {
|
||||||
|
// keep the previous term type name as it would otherwise force us
|
||||||
// remove previous term type
|
// to update all terms to use another type
|
||||||
contentDefinitionManager.DeleteTypeDefinition(previousTermTypeName);
|
part.TermTypeName = previousTermTypeName;
|
||||||
|
|
||||||
// update existing fields
|
// update existing fields
|
||||||
foreach (var partDefinition in contentDefinitionManager.ListPartDefinitions()) {
|
foreach (var partDefinition in contentDefinitionManager.ListPartDefinitions()) {
|
||||||
|
Loading…
Reference in New Issue
Block a user