2021-03-04 07:14:54 +01:00
|
|
|
// Copyright (c) Umbraco.
|
|
|
|
|
// See LICENSE for more details.
|
|
|
|
|
|
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
|
2021-03-16 06:55:55 +01:00
|
|
|
.AddNotificationHandler<ContentSavedNotification, UserNotificationsHandler>()
|
|
|
|
|
.AddNotificationHandler<ContentSortedNotification, UserNotificationsHandler>()
|
|
|
|
|
.AddNotificationHandler<ContentPublishedNotification, UserNotificationsHandler>()
|
|
|
|
|
.AddNotificationHandler<ContentMovedNotification, UserNotificationsHandler>()
|
|
|
|
|
.AddNotificationHandler<ContentMovedToRecycleBinNotification, UserNotificationsHandler>()
|
|
|
|
|
.AddNotificationHandler<ContentCopiedNotification, UserNotificationsHandler>()
|
|
|
|
|
.AddNotificationHandler<ContentRolledBackNotification, UserNotificationsHandler>()
|
|
|
|
|
.AddNotificationHandler<ContentSentToPublishNotification, UserNotificationsHandler>()
|
|
|
|
|
.AddNotificationHandler<ContentUnpublishedNotification, UserNotificationsHandler>();
|
2021-03-03 09:02:29 +01:00
|
|
|
|
|
|
|
|
// add handlers for building content relations
|
|
|
|
|
builder
|
2021-03-16 06:55:55 +01:00
|
|
|
.AddNotificationHandler<ContentCopiedNotification, RelateOnCopyNotificationHandler>()
|
|
|
|
|
.AddNotificationHandler<ContentMovedNotification, RelateOnTrashNotificationHandler>()
|
|
|
|
|
.AddNotificationHandler<ContentMovedToRecycleBinNotification, RelateOnTrashNotificationHandler>()
|
|
|
|
|
.AddNotificationHandler<MediaMovedNotification, RelateOnTrashNotificationHandler>()
|
|
|
|
|
.AddNotificationHandler<MediaMovedToRecycleBinNotification, RelateOnTrashNotificationHandler>();
|
2021-03-03 09:02:29 +01:00
|
|
|
|
|
|
|
|
// add notification handlers for property editors
|
|
|
|
|
builder
|
2021-03-16 06:55:55 +01:00
|
|
|
.AddNotificationHandler<ContentSavingNotification, BlockEditorPropertyHandler>()
|
|
|
|
|
.AddNotificationHandler<ContentCopyingNotification, BlockEditorPropertyHandler>()
|
|
|
|
|
.AddNotificationHandler<ContentSavingNotification, NestedContentPropertyHandler>()
|
|
|
|
|
.AddNotificationHandler<ContentCopyingNotification, NestedContentPropertyHandler>()
|
|
|
|
|
.AddNotificationHandler<ContentCopiedNotification, FileUploadPropertyEditor>()
|
|
|
|
|
.AddNotificationHandler<ContentDeletedNotification, FileUploadPropertyEditor>()
|
|
|
|
|
.AddNotificationHandler<MediaDeletedNotification, FileUploadPropertyEditor>()
|
|
|
|
|
.AddNotificationHandler<MediaSavingNotification, FileUploadPropertyEditor>()
|
|
|
|
|
.AddNotificationHandler<ContentCopiedNotification, ImageCropperPropertyEditor>()
|
|
|
|
|
.AddNotificationHandler<ContentDeletedNotification, ImageCropperPropertyEditor>()
|
|
|
|
|
.AddNotificationHandler<MediaDeletedNotification, ImageCropperPropertyEditor>()
|
|
|
|
|
.AddNotificationHandler<MediaSavingNotification, ImageCropperPropertyEditor>();
|
2021-03-03 09:02:29 +01:00
|
|
|
|
|
|
|
|
// add notification handlers for redirect tracking
|
|
|
|
|
builder
|
2021-03-16 06:55:55 +01:00
|
|
|
.AddNotificationHandler<ContentPublishingNotification, RedirectTrackingHandler>()
|
|
|
|
|
.AddNotificationHandler<ContentPublishedNotification, RedirectTrackingHandler>()
|
|
|
|
|
.AddNotificationHandler<ContentMovingNotification, RedirectTrackingHandler>()
|
|
|
|
|
.AddNotificationHandler<ContentMovedNotification, RedirectTrackingHandler>();
|
2019-01-03 21:00:28 +01:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|