Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

listen for ContainerRename events #524

Merged
merged 1 commit into from
Jul 31, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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