mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-12-03 12:03:51 +08:00
#18909: Deleting associated publishing tasks when a content item is deleted
Work Item: 18909 --HG-- branch : 1.x
This commit is contained in:
@@ -1,16 +1,20 @@
|
|||||||
using Orchard.ContentManagement.Handlers;
|
using Orchard.ContentManagement.Handlers;
|
||||||
using Orchard.PublishLater.Models;
|
using Orchard.PublishLater.Models;
|
||||||
using Orchard.PublishLater.Services;
|
using Orchard.PublishLater.Services;
|
||||||
|
using Orchard.Tasks.Scheduling;
|
||||||
|
|
||||||
namespace Orchard.PublishLater.Handlers {
|
namespace Orchard.PublishLater.Handlers {
|
||||||
public class PublishLaterPartHandler : ContentHandler {
|
public class PublishLaterPartHandler : ContentHandler {
|
||||||
private readonly IPublishLaterService _publishLaterService;
|
private readonly IPublishLaterService _publishLaterService;
|
||||||
|
|
||||||
public PublishLaterPartHandler(IPublishLaterService publishLaterService) {
|
public PublishLaterPartHandler(
|
||||||
|
IPublishLaterService publishLaterService,
|
||||||
|
IPublishingTaskManager publishingTaskManager) {
|
||||||
_publishLaterService = publishLaterService;
|
_publishLaterService = publishLaterService;
|
||||||
|
|
||||||
OnLoading<PublishLaterPart>((context, part) => LazyLoadHandlers(part));
|
OnLoading<PublishLaterPart>((context, part) => LazyLoadHandlers(part));
|
||||||
OnVersioning<PublishLaterPart>((context, part, newVersionPart) => LazyLoadHandlers(newVersionPart));
|
OnVersioning<PublishLaterPart>((context, part, newVersionPart) => LazyLoadHandlers(newVersionPart));
|
||||||
|
OnRemoved<PublishLaterPart>((context, part) => publishingTaskManager.DeleteTasks(part.ContentItem));
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void LazyLoadHandlers(PublishLaterPart part) {
|
protected void LazyLoadHandlers(PublishLaterPart part) {
|
||||||
|
|||||||
Reference in New Issue
Block a user