U4-10764 - Deleting a node through the content service does not unpublish it and remove it

Created by Claus Jensen 14 Dec 2017, 20:40:19 Updated by Shannon Deminick 20 Dec 2017, 06:29:02

Tags: Unscheduled

Subtask of: U4-9609

When deleting content using ContentService.Delete(content) it is supposed to check if there is a published version of this content. If one exist - it will call Unpublish on that content to remove it from the published content cache.

This all seems to run - but for some reason the content is not removed from the published content cache and can still be accessed. If you unpublish the content before deleting it, it is removed as expected.

From what I'm seeing, it successfully runs the exact same Unpublish method (that works) .. when you use the Delete method, but the effect of running that method is apparently different when run in the context of the delete method.


Stephan 18 Dec 2017, 10:37:24


The "unpublished" event is not dispatched when the scope is disposed, because of our events filtering logic, which decides that since there is a "deleted" event in the list, there's no point dispatching prior events for thta content item.

Looking into fix.

Stephan 18 Dec 2017, 10:45:33

An event may "supercede" another one... meaning if it appears in the list after the other one, the other one won't be raised. However... this does not work per event type really, but per event args type - so anything with DeleteEventArgs would supercede anything with PublishEventArgs - and it turns out we do not have "unpublish" event args - both publish and unpublish share the same PublishEventArgs. Therefore... delete supercedes unpublish too.

Cannot change the event args of ContentService.Unpublished without creating a backward compatibility issue. Which means it's the whole "supercede" logic which has to be refactored somehow.

Task slowly turning from "small" into "medium-largish" ;-((

Stephan 18 Dec 2017, 15:56:55

Right, PR here https://github.com/umbraco/Umbraco-CMS/pull/2354

I have tried to see how things could be refactored without spending a lot of time, and failed, so this is an ugly work around this very issue, and nothing else - scope and events are somewhat broken, never realised it, and it will have to be fixed eventually (have created U4-10771).

Review = this very problem should be fixed.

Priority: Major

Type: Bug

State: Fixed


Difficulty: Normal


Backwards Compatible: True

Fix Submitted:

Affected versions: 7.7.7

Due in version: 7.7.8

Sprint: Sprint 74

Story Points: 1

Cycle: 6