diff --git a/src/Umbraco.Web/Compose/NotificationsComponent.cs b/src/Umbraco.Web/Compose/NotificationsComponent.cs index c099fde8ef..43f6621e51 100644 --- a/src/Umbraco.Web/Compose/NotificationsComponent.cs +++ b/src/Umbraco.Web/Compose/NotificationsComponent.cs @@ -20,11 +20,13 @@ namespace Umbraco.Web.Compose { private readonly Notifier _notifier; private readonly ActionCollection _actions; + private readonly IContentService _contentService; - public NotificationsComponent(Notifier notifier, ActionCollection actions) + public NotificationsComponent(Notifier notifier, ActionCollection actions, IContentService contentService) { _notifier = notifier; _actions = actions; + _contentService = contentService; } public void Initialize() @@ -54,7 +56,10 @@ namespace Umbraco.Web.Compose ContentService.Copied += (sender, args) => _notifier.Notify(_actions.GetAction(), args.Original); //Send notifications for the rollback action - ContentService.RolledBack += (sender, args) => _notifier.Notify(_actions.GetAction(), args.Entity); + ContentService.RolledBack += (sender, args) => _notifier.Notify(_actions.GetAction(), args.Entity); + + //Send notifications for the public access changed action + PublicAccessService.Saved += (sender, args) => PublicAccessServiceSaved(_notifier, sender, args, _contentService, _actions); } public void Terminate() @@ -115,6 +120,16 @@ namespace Umbraco.Web.Compose } } + private void PublicAccessServiceSaved(Notifier notifier, IPublicAccessService sender, Core.Events.SaveEventArgs args, IContentService contentService, ActionCollection actions) + { + var entities = contentService.GetByIds(args.SavedEntities.Select(e => e.ProtectedNodeId)).ToArray(); + if(entities.Any() == false) + { + return; + } + notifier.Notify(actions.GetAction(), entities); + } + /// /// This class is used to send the notifications ///