V7: Send notifications when an item is moved or restored (#5303)

This commit is contained in:
Sebastiaan Janssen
2019-04-22 13:04:14 +02:00
committed by GitHub

View File

@@ -72,11 +72,30 @@ namespace Umbraco.Web.Strategies
content =>
applicationContext.Services.NotificationService.SendNotification(
content, ActionUnPublish.Instance, applicationContext));
//Send notifications for the rollback action
ContentService.RolledBack += (sender, args) => applicationContext.Services.NotificationService.SendNotification(
args.Entity, ActionRollback.Instance, applicationContext
);
args.Entity, ActionRollback.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
);
}
};
}
}