2021-03-03 09:02:29 +01:00
|
|
|
using Umbraco.Cms.Core.Composing;
|
2021-02-09 10:22:42 +01:00
|
|
|
using Umbraco.Cms.Core.DependencyInjection;
|
2021-03-03 09:15:52 +01:00
|
|
|
using Umbraco.Cms.Core.Events;
|
2021-03-03 09:02:29 +01:00
|
|
|
using Umbraco.Cms.Core.Models;
|
|
|
|
|
using Umbraco.Cms.Core.PropertyEditors;
|
|
|
|
|
using Umbraco.Cms.Core.Routing;
|
|
|
|
|
using Umbraco.Cms.Infrastructure.Services.Notifications;
|
2021-02-09 13:32:34 +01:00
|
|
|
using Umbraco.Extensions;
|
2019-01-03 21:00:28 +01:00
|
|
|
|
2021-02-12 10:24:19 +01:00
|
|
|
namespace Umbraco.Cms.Core.Compose
|
2019-01-03 21:00:28 +01:00
|
|
|
{
|
2019-01-05 15:49:10 +01:00
|
|
|
public sealed class NotificationsComposer : ComponentComposer<NotificationsComponent>, ICoreComposer
|
2019-01-03 21:00:28 +01:00
|
|
|
{
|
2020-11-18 17:40:23 +00:00
|
|
|
public override void Compose(IUmbracoBuilder builder)
|
2019-01-03 21:00:28 +01:00
|
|
|
{
|
2020-11-18 17:40:23 +00:00
|
|
|
base.Compose(builder);
|
2019-01-05 15:49:10 +01:00
|
|
|
|
2020-11-18 17:40:23 +00:00
|
|
|
builder.Services.AddUnique<NotificationsComponent.Notifier>();
|
2021-03-03 09:02:29 +01:00
|
|
|
|
|
|
|
|
// add handlers for sending user notifications (i.e. emails)
|
|
|
|
|
builder.Services.AddUnique<UserNotificationsHandler.Notifier>();
|
|
|
|
|
builder
|
|
|
|
|
.AddNotificationHandler<SavedNotification<IContent>, UserNotificationsHandler>()
|
|
|
|
|
.AddNotificationHandler<SortedNotification<IContent>, UserNotificationsHandler>()
|
|
|
|
|
.AddNotificationHandler<PublishedNotification<IContent>, UserNotificationsHandler>()
|
|
|
|
|
.AddNotificationHandler<MovedNotification<IContent>, UserNotificationsHandler>()
|
|
|
|
|
.AddNotificationHandler<MovedToRecycleBinNotification<IContent>, UserNotificationsHandler>()
|
|
|
|
|
.AddNotificationHandler<CopiedNotification<IContent>, UserNotificationsHandler>()
|
|
|
|
|
.AddNotificationHandler<RolledBackNotification<IContent>, UserNotificationsHandler>()
|
|
|
|
|
.AddNotificationHandler<SentToPublishNotification<IContent>, UserNotificationsHandler>()
|
|
|
|
|
.AddNotificationHandler<UnpublishedNotification<IContent>, UserNotificationsHandler>();
|
|
|
|
|
|
|
|
|
|
// add handlers for building content relations
|
|
|
|
|
builder
|
2021-03-03 09:16:48 +01:00
|
|
|
.AddNotificationHandler<CopiedNotification<IContent>, RelateOnCopyNotifcationHandler>()
|
|
|
|
|
.AddNotificationHandler<MovedNotification<IContent>, RelateOnTrashNotificationHandler>()
|
|
|
|
|
.AddNotificationHandler<MovedToRecycleBinNotification<IContent>, RelateOnTrashNotificationHandler>()
|
|
|
|
|
.AddNotificationHandler<MovedNotification<IMedia>, RelateOnTrashNotificationHandler>()
|
|
|
|
|
.AddNotificationHandler<MovedToRecycleBinNotification<IMedia>, RelateOnTrashNotificationHandler>();
|
2021-03-03 09:02:29 +01:00
|
|
|
|
|
|
|
|
// add notification handlers for property editors
|
|
|
|
|
builder
|
|
|
|
|
.AddNotificationHandler<SavingNotification<IContent>, BlockEditorPropertyHandler>()
|
|
|
|
|
.AddNotificationHandler<CopyingNotification<IContent>, BlockEditorPropertyHandler>()
|
|
|
|
|
.AddNotificationHandler<SavingNotification<IContent>, NestedContentPropertyHandler>()
|
|
|
|
|
.AddNotificationHandler<CopyingNotification<IContent>, NestedContentPropertyHandler>()
|
|
|
|
|
.AddNotificationHandler<CopiedNotification<IContent>, FileUploadPropertyEditor>()
|
|
|
|
|
.AddNotificationHandler<DeletedNotification<IContent>, FileUploadPropertyEditor>()
|
|
|
|
|
.AddNotificationHandler<DeletedNotification<IMedia>, FileUploadPropertyEditor>()
|
|
|
|
|
.AddNotificationHandler<SavingNotification<IMedia>, FileUploadPropertyEditor>()
|
|
|
|
|
.AddNotificationHandler<CopiedNotification<IContent>, ImageCropperPropertyEditor>()
|
|
|
|
|
.AddNotificationHandler<DeletedNotification<IContent>, ImageCropperPropertyEditor>()
|
|
|
|
|
.AddNotificationHandler<DeletedNotification<IMedia>, ImageCropperPropertyEditor>()
|
|
|
|
|
.AddNotificationHandler<SavingNotification<IMedia>, ImageCropperPropertyEditor>();
|
|
|
|
|
|
|
|
|
|
// add notification handlers for redirect tracking
|
|
|
|
|
builder
|
|
|
|
|
.AddNotificationHandler<PublishingNotification<IContent>, RedirectTrackingHandler>()
|
|
|
|
|
.AddNotificationHandler<PublishedNotification<IContent>, RedirectTrackingHandler>()
|
|
|
|
|
.AddNotificationHandler<MovingNotification<IContent>, RedirectTrackingHandler>()
|
|
|
|
|
.AddNotificationHandler<MovedNotification<IContent>, RedirectTrackingHandler>();
|
2019-01-03 21:00:28 +01:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|