From 38bb98b099b9805e4bcf22158934c50810191266 Mon Sep 17 00:00:00 2001 From: Kenn Jacobsen Date: Sat, 20 Apr 2019 20:31:36 +0200 Subject: [PATCH 1/3] Send notifications when an item is copied --- src/Umbraco.Web/Strategies/NotificationsHandler.cs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/Umbraco.Web/Strategies/NotificationsHandler.cs b/src/Umbraco.Web/Strategies/NotificationsHandler.cs index a085bd463a..28b69a54cb 100644 --- a/src/Umbraco.Web/Strategies/NotificationsHandler.cs +++ b/src/Umbraco.Web/Strategies/NotificationsHandler.cs @@ -73,6 +73,10 @@ namespace Umbraco.Web.Strategies applicationContext.Services.NotificationService.SendNotification( content, ActionUnPublish.Instance, applicationContext)); + //Send notifications for the copy action + ContentService.Copied += (sender, args) => applicationContext.Services.NotificationService.SendNotification( + args.Original, ActionCopy.Instance, applicationContext + ); } } From d2f727a1ba2acb00df34363344666dc38f94643e Mon Sep 17 00:00:00 2001 From: Kenn Jacobsen Date: Sat, 20 Apr 2019 20:40:52 +0200 Subject: [PATCH 2/3] Send notifications when an item is moved or restored --- .../Strategies/NotificationsHandler.cs | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/src/Umbraco.Web/Strategies/NotificationsHandler.cs b/src/Umbraco.Web/Strategies/NotificationsHandler.cs index a085bd463a..f7dfca59dd 100644 --- a/src/Umbraco.Web/Strategies/NotificationsHandler.cs +++ b/src/Umbraco.Web/Strategies/NotificationsHandler.cs @@ -73,6 +73,25 @@ namespace Umbraco.Web.Strategies applicationContext.Services.NotificationService.SendNotification( content, ActionUnPublish.Instance, applicationContext)); + //Send notifications for the move and restore actions + ContentService.Moved += (sender, args) => + { + // notify about the move for all moved items + foreach(var moveInfo in args.MoveInfoCollection) + { + applicationContext.Services.NotificationService.SendNotification( + moveInfo.Entity, ActionMove.Instance, applicationContext + ); + } + + // for any items being moved from the recycle bin (restored), explicitly notify about that too + foreach(var moveInfo in args.MoveInfoCollection.Where(m => m.OriginalPath.Contains(Constants.System.RecycleBinContentString))) + { + applicationContext.Services.NotificationService.SendNotification( + moveInfo.Entity, ActionRestore.Instance, applicationContext + ); + } + }; } } From ff4fe2cd79084f7e0376e132e3b88c1c780a4ae3 Mon Sep 17 00:00:00 2001 From: Kenn Jacobsen Date: Sun, 21 Apr 2019 13:22:49 +0200 Subject: [PATCH 3/3] Send notifications for changes in permissions --- src/Umbraco.Web/Strategies/NotificationsHandler.cs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/Umbraco.Web/Strategies/NotificationsHandler.cs b/src/Umbraco.Web/Strategies/NotificationsHandler.cs index a085bd463a..35f2f382c8 100644 --- a/src/Umbraco.Web/Strategies/NotificationsHandler.cs +++ b/src/Umbraco.Web/Strategies/NotificationsHandler.cs @@ -73,6 +73,18 @@ namespace Umbraco.Web.Strategies applicationContext.Services.NotificationService.SendNotification( content, ActionUnPublish.Instance, applicationContext)); + //Send notifications for the permissions action + UserService.UserGroupPermissionsAssigned += (sender, args) => + { + var entities = applicationContext.Services.ContentService.GetByIds(args.SavedEntities.Select(e => e.EntityId)); + + foreach(var entity in entities) + { + applicationContext.Services.NotificationService.SendNotification( + entity, ActionRights.Instance, applicationContext + ); + } + }; } }