Skip to content

Commit

Permalink
#523 - listd for ContainerRename events as these fire on rename and s…
Browse files Browse the repository at this point in the history
…ave doesn't.
  • Loading branch information
KevinJump committed Jul 27, 2023
1 parent e945335 commit ee53482
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 5 deletions.
3 changes: 2 additions & 1 deletion uSync.BackOffice/SyncHandlers/Handlers/ContentTypeHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ public class ContentTypeHandler : SyncHandlerContainerBase<IContentType, IConten
INotificationHandler<SavedNotification<IContentType>>,
INotificationHandler<DeletedNotification<IContentType>>,
INotificationHandler<MovedNotification<IContentType>>,
INotificationHandler<EntityContainerSavedNotification>
INotificationHandler<EntityContainerSavedNotification>,
INotificationHandler<EntityContainerRenamedNotification>
{
private readonly IContentTypeService contentTypeService;

Expand Down
3 changes: 2 additions & 1 deletion uSync.BackOffice/SyncHandlers/Handlers/DataTypeHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ public class DataTypeHandler : SyncHandlerContainerBase<IDataType, IDataTypeServ
INotificationHandler<SavedNotification<IDataType>>,
INotificationHandler<MovedNotification<IDataType>>,
INotificationHandler<DeletedNotification<IDataType>>,
INotificationHandler<EntityContainerSavedNotification>
INotificationHandler<EntityContainerSavedNotification>,
INotificationHandler<EntityContainerRenamedNotification>
{
private readonly IDataTypeService dataTypeService;

Expand Down
3 changes: 2 additions & 1 deletion uSync.BackOffice/SyncHandlers/Handlers/MediaTypeHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ public class MediaTypeHandler : SyncHandlerContainerBase<IMediaType, IMediaTypeS
INotificationHandler<SavedNotification<IMediaType>>,
INotificationHandler<DeletedNotification<IMediaType>>,
INotificationHandler<MovedNotification<IMediaType>>,
INotificationHandler<EntityContainerSavedNotification>
INotificationHandler<EntityContainerSavedNotification>,
INotificationHandler<EntityContainerRenamedNotification>
// INotificationHandler<MediaTypeSavedNotification>
{
private readonly IMediaTypeService mediaTypeService;
Expand Down
4 changes: 3 additions & 1 deletion uSync.BackOffice/SyncHandlers/Handlers/MemberTypeHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,9 @@ namespace uSync.BackOffice.SyncHandlers.Handlers
public class MemberTypeHandler : SyncHandlerContainerBase<IMemberType, IMemberTypeService>, ISyncHandler,
INotificationHandler<SavedNotification<IMemberType>>,
INotificationHandler<MovedNotification<IMemberType>>,
INotificationHandler<DeletedNotification<IMemberType>>
INotificationHandler<DeletedNotification<IMemberType>>,
INotificationHandler<EntityContainerSavedNotification>,
INotificationHandler<EntityContainerRenamedNotification>
{
private readonly IMemberTypeService memberTypeService;

Expand Down
13 changes: 12 additions & 1 deletion uSync.BackOffice/SyncHandlers/SyncHandlerContainerBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,18 @@ public virtual void Handle(EntityContainerSavedNotification notification)
{
if (_mutexService.IsPaused) return;

foreach (var folder in notification.SavedEntities)
ProcessContainerChanges(notification.SavedEntities);
}

public virtual void Handle(EntityContainerRenamedNotification notification)
{
if (_mutexService.IsPaused) return;
ProcessContainerChanges(notification.Entities);
}

private void ProcessContainerChanges(IEnumerable<EntityContainer> containers)
{
foreach (var folder in containers)
{
if (folder.ContainedObjectType == this.itemObjectType.GetGuid())
{
Expand Down
5 changes: 5 additions & 0 deletions uSync.BackOffice/uSyncBackOfficeBuilderExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -127,20 +127,25 @@ internal static void AddHandlerNotifications(this IUmbracoBuilder builder)
builder.AddNotificationHandler<DataTypeDeletedNotification, DataTypeHandler>();
builder.AddNotificationHandler<DataTypeMovedNotification, DataTypeHandler>();
builder.AddNotificationHandler<EntityContainerSavedNotification, DataTypeHandler>();
builder.AddNotificationHandler<EntityContainerRenamedNotification, DataTypeHandler>();

builder.AddNotificationHandler<ContentTypeSavedNotification, ContentTypeHandler>();
builder.AddNotificationHandler<ContentTypeDeletedNotification, ContentTypeHandler>();
builder.AddNotificationHandler<ContentTypeMovedNotification, ContentTypeHandler>();
builder.AddNotificationHandler<EntityContainerSavedNotification, ContentTypeHandler>();
builder.AddNotificationHandler<EntityContainerRenamedNotification, ContentTypeHandler>();

builder.AddNotificationHandler<MediaTypeSavedNotification, MediaTypeHandler>();
builder.AddNotificationHandler<MediaTypeDeletedNotification, MediaTypeHandler>();
builder.AddNotificationHandler<MediaTypeMovedNotification, MediaTypeHandler>();
builder.AddNotificationHandler<EntityContainerSavedNotification, MediaTypeHandler>();
builder.AddNotificationHandler<EntityContainerRenamedNotification, MediaTypeHandler>();

builder.AddNotificationHandler<MemberTypeSavedNotification, MemberTypeHandler>();
builder.AddNotificationHandler<MemberTypeSavedNotification, MemberTypeHandler>();
builder.AddNotificationHandler<MemberTypeMovedNotification, MemberTypeHandler>();
builder.AddNotificationHandler<EntityContainerSavedNotification, MemberTypeHandler>();
builder.AddNotificationHandler<EntityContainerRenamedNotification, MemberTypeHandler>();

builder.AddNotificationHandler<LanguageSavingNotification, LanguageHandler>();
builder.AddNotificationHandler<LanguageSavedNotification, LanguageHandler>();
Expand Down

0 comments on commit ee53482

Please sign in to comment.