Skip to content

Commit 1fb88d0

Browse files
authored
Fixed #683 - relations not exporting. (#639)
1 parent 5fb73be commit 1fb88d0

File tree

1 file changed

+14
-70
lines changed

1 file changed

+14
-70
lines changed

uSync.BackOffice/SyncHandlers/Handlers/RelationTypeHandler.cs

+14-70
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
using Umbraco.Cms.Core.Cache;
88
using Umbraco.Cms.Core.Events;
99
using Umbraco.Cms.Core.Models;
10+
using Umbraco.Cms.Core.Models.Entities;
1011
using Umbraco.Cms.Core.Notifications;
1112
using Umbraco.Cms.Core.Services;
1213
using Umbraco.Cms.Core.Strings;
@@ -70,12 +71,11 @@ public override IEnumerable<uSyncAction> ExportAll(string folder, HandlerSetting
7071
return actions;
7172
}
7273

73-
74-
/// <summary>
75-
/// Relations that by default we exclude, if the exlude setting is used,then it will override these values
76-
/// and they will be included if not explicity set;
77-
/// </summary>
78-
private const string defaultRelations = "relateParentDocumentOnDelete,relateParentMediaFolderOnDelete,relateDocumentOnCopy,umbMedia,umbDocument";
74+
/// <summary>
75+
/// Relations that by default we exclude, if the exlude setting is used,then it will override these values
76+
/// and they will be included if not explicity set;
77+
/// </summary>
78+
private const string defaultRelations = "relateParentDocumentOnDelete,relateParentMediaFolderOnDelete,relateDocumentOnCopy,umbMedia,umbDocument";
7979

8080
/// <summary>
8181
/// Workout if we are excluding this relationType from export/import
@@ -103,68 +103,12 @@ protected override string GetItemName(IRelationType item)
103103
protected override string GetItemFileName(IRelationType item)
104104
=> GetItemAlias(item).ToSafeAlias(shortStringHelper);
105105

106-
// private void RelationService_SavedRelation(IRelationService sender, Umbraco.Core.Events.SaveEventArgs<IRelation> e)
107-
// {
108-
// if (uSync8BackOffice.eventsPaused) return;
109-
110-
// lock (saveLock)
111-
// {
112-
// saveTimer.Stop();
113-
// saveTimer.Start();
114-
115-
// // add each item to the save list (if we haven't already)
116-
// foreach (var item in e.SavedEntities)
117-
// {
118-
// if (!pendingSaveIds.Contains(item.RelationTypeId))
119-
// pendingSaveIds.Add(item.RelationTypeId);
120-
// }
121-
// }
122-
// }
123-
124-
// private void SaveTimer_Elapsed(object sender, ElapsedEventArgs e)
125-
// {
126-
// lock (saveLock)
127-
// {
128-
// UpdateRelationTypes(pendingSaveIds);
129-
// pendingSaveIds.Clear();
130-
// }
131-
// }
132-
133-
// private static Timer saveTimer;
134-
// private static List<int> pendingSaveIds;
135-
// private static object saveLock;
136-
137-
// private void RelationService_DeletedRelation(IRelationService sender, Umbraco.Core.Events.DeleteEventArgs<IRelation> e)
138-
// {
139-
// if (uSync8BackOffice.eventsPaused) return;
140-
141-
// var types = new List<int>();
142-
143-
// foreach (var item in e.DeletedEntities)
144-
// {
145-
// if (!types.Contains(item.RelationTypeId))
146-
// types.Add(item.RelationTypeId);
147-
// }
148-
149-
// UpdateRelationTypes(types);
150-
// }
151-
152-
// private void UpdateRelationTypes(IEnumerable<int> types)
153-
// {
154-
// foreach (var type in types)
155-
// {
156-
// var relationType = relationService.GetRelationTypeById(type);
157-
158-
// var attempts = Export(relationType, Path.Combine(rootFolder, this.DefaultFolder), DefaultConfig);
159-
160-
// if (!(this.DefaultConfig.GuidNames && this.DefaultConfig.UseFlatStructure))
161-
// {
162-
// foreach (var attempt in attempts.Where(x => x.Success))
163-
// {
164-
// this.CleanUp(relationType, attempt.FileName, Path.Combine(rootFolder, this.DefaultFolder));
165-
// }
166-
// }
167-
// }
168-
// }
169-
}
106+
protected override IEnumerable<IEntity> GetChildItems(int parent)
107+
{
108+
if (parent == -1)
109+
return relationService.GetAllRelationTypes();
110+
111+
return [];
112+
}
113+
}
170114
}

0 commit comments

Comments
 (0)