From 4a7bf95926c1a27b1dc86f6b2bd3a70b905875aa Mon Sep 17 00:00:00 2001 From: Michael Date: Tue, 15 May 2018 15:51:58 +0000 Subject: [PATCH] Fix: Delete all item copies if it is an original item --- src/Model/Item.php | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/Model/Item.php b/src/Model/Item.php index ab291a3306..10e5f9e8e2 100644 --- a/src/Model/Item.php +++ b/src/Model/Item.php @@ -112,8 +112,8 @@ class Item extends BaseObject public static function deleteById($item_id, $priority = PRIORITY_HIGH) { // locate item to be deleted - $fields = ['id', 'uid', 'parent', 'parent-uri', 'origin', 'deleted', - 'file', 'resource-id', 'event-id', 'attach', + $fields = ['id', 'uri', 'uid', 'parent', 'parent-uri', 'origin', + 'deleted', 'file', 'resource-id', 'event-id', 'attach', 'verb', 'object-type', 'object', 'target', 'contact-id']; $item = dba::selectFirst('item', $fields, ['id' => $item_id]); if (!DBM::is_result($item)) { @@ -188,8 +188,13 @@ class Item extends BaseObject self::delete(['parent' => $item['parent']], $priority); } - // send the notification upstream/downstream + // Is it our comment and/or our thread? if ($item['origin'] || $parent['origin']) { + + // When we delete the original post we will delete all existing copies on the server as well + self::delete(['uri' => $item['uri'], 'deleted' => false], $priority); + + // send the notification upstream/downstream Worker::add(['priority' => $priority, 'dont_fork' => true], "Notifier", "drop", intval($item['id'])); }