#18909: Deleting associated publishing tasks when a content item is deleted

Work Item: 18909

--HG--
branch : 1.x
This commit is contained in:
Sebastien Ros
2012-09-21 17:13:38 -07:00
parent ce8cbff36c
commit 7890814c01

View File

@@ -1,16 +1,20 @@
using Orchard.ContentManagement.Handlers;
using Orchard.PublishLater.Models;
using Orchard.PublishLater.Services;
using Orchard.Tasks.Scheduling;
namespace Orchard.PublishLater.Handlers {
public class PublishLaterPartHandler : ContentHandler {
private readonly IPublishLaterService _publishLaterService;
public PublishLaterPartHandler(IPublishLaterService publishLaterService) {
public PublishLaterPartHandler(
IPublishLaterService publishLaterService,
IPublishingTaskManager publishingTaskManager) {
_publishLaterService = publishLaterService;
OnLoading<PublishLaterPart>((context, part) => LazyLoadHandlers(part));
OnVersioning<PublishLaterPart>((context, part, newVersionPart) => LazyLoadHandlers(newVersionPart));
OnRemoved<PublishLaterPart>((context, part) => publishingTaskManager.DeleteTasks(part.ContentItem));
}
protected void LazyLoadHandlers(PublishLaterPart part) {