diff --git a/uSync.BackOffice/SyncHandlers/Handlers/RelationTypeHandler.cs b/uSync.BackOffice/SyncHandlers/Handlers/RelationTypeHandler.cs index 91cd85eb..96b279b7 100644 --- a/uSync.BackOffice/SyncHandlers/Handlers/RelationTypeHandler.cs +++ b/uSync.BackOffice/SyncHandlers/Handlers/RelationTypeHandler.cs @@ -7,6 +7,7 @@ using Umbraco.Cms.Core.Cache; using Umbraco.Cms.Core.Events; using Umbraco.Cms.Core.Models; +using Umbraco.Cms.Core.Models.Entities; using Umbraco.Cms.Core.Notifications; using Umbraco.Cms.Core.Services; using Umbraco.Cms.Core.Strings; @@ -70,12 +71,11 @@ public override IEnumerable ExportAll(string folder, HandlerSetting return actions; } - - /// - /// Relations that by default we exclude, if the exlude setting is used,then it will override these values - /// and they will be included if not explicity set; - /// - private const string defaultRelations = "relateParentDocumentOnDelete,relateParentMediaFolderOnDelete,relateDocumentOnCopy,umbMedia,umbDocument"; + /// + /// Relations that by default we exclude, if the exlude setting is used,then it will override these values + /// and they will be included if not explicity set; + /// + private const string defaultRelations = "relateParentDocumentOnDelete,relateParentMediaFolderOnDelete,relateDocumentOnCopy,umbMedia,umbDocument"; /// /// Workout if we are excluding this relationType from export/import @@ -103,68 +103,12 @@ protected override string GetItemName(IRelationType item) protected override string GetItemFileName(IRelationType item) => GetItemAlias(item).ToSafeAlias(shortStringHelper); - // private void RelationService_SavedRelation(IRelationService sender, Umbraco.Core.Events.SaveEventArgs e) - // { - // if (uSync8BackOffice.eventsPaused) return; - - // lock (saveLock) - // { - // saveTimer.Stop(); - // saveTimer.Start(); - - // // add each item to the save list (if we haven't already) - // foreach (var item in e.SavedEntities) - // { - // if (!pendingSaveIds.Contains(item.RelationTypeId)) - // pendingSaveIds.Add(item.RelationTypeId); - // } - // } - // } - - // private void SaveTimer_Elapsed(object sender, ElapsedEventArgs e) - // { - // lock (saveLock) - // { - // UpdateRelationTypes(pendingSaveIds); - // pendingSaveIds.Clear(); - // } - // } - - // private static Timer saveTimer; - // private static List pendingSaveIds; - // private static object saveLock; - - // private void RelationService_DeletedRelation(IRelationService sender, Umbraco.Core.Events.DeleteEventArgs e) - // { - // if (uSync8BackOffice.eventsPaused) return; - - // var types = new List(); - - // foreach (var item in e.DeletedEntities) - // { - // if (!types.Contains(item.RelationTypeId)) - // types.Add(item.RelationTypeId); - // } - - // UpdateRelationTypes(types); - // } - - // private void UpdateRelationTypes(IEnumerable types) - // { - // foreach (var type in types) - // { - // var relationType = relationService.GetRelationTypeById(type); - - // var attempts = Export(relationType, Path.Combine(rootFolder, this.DefaultFolder), DefaultConfig); - - // if (!(this.DefaultConfig.GuidNames && this.DefaultConfig.UseFlatStructure)) - // { - // foreach (var attempt in attempts.Where(x => x.Success)) - // { - // this.CleanUp(relationType, attempt.FileName, Path.Combine(rootFolder, this.DefaultFolder)); - // } - // } - // } - // } - } + protected override IEnumerable GetChildItems(int parent) + { + if (parent == -1) + return relationService.GetAllRelationTypes(); + + return []; + } + } } \ No newline at end of file