mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-07-31 01:57:39 +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));
|
||||
OnPublished<TaxonomyPart>((context, part) => {
|
||||
var previousTermTypeName = part.TermTypeName;
|
||||
taxonomyService.CreateTermContentType(part);
|
||||
|
||||
if (previousName != null && part.Name != previousName) {
|
||||
|
||||
// remove previous term type
|
||||
contentDefinitionManager.DeleteTypeDefinition(previousTermTypeName);
|
||||
|
||||
if (previousName == null || part.Name == previousName) {
|
||||
// is it a new taxonomy ?
|
||||
taxonomyService.CreateTermContentType(part);
|
||||
}
|
||||
else {
|
||||
// keep the previous term type name as it would otherwise force us
|
||||
// to update all terms to use another type
|
||||
part.TermTypeName = previousTermTypeName;
|
||||
|
||||
// update existing fields
|
||||
foreach (var partDefinition in contentDefinitionManager.ListPartDefinitions()) {
|
||||
|
Loading…
Reference in New Issue
Block a user