From 3e475f3b822fdd1a54014906d68bb671166eb5ff Mon Sep 17 00:00:00 2001 From: Michael Date: Tue, 15 May 2018 16:40:13 +0000 Subject: [PATCH] Delete the shadow post when it is the last one --- src/Model/Item.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/Model/Item.php b/src/Model/Item.php index 10e5f9e8e2..0606f017ed 100644 --- a/src/Model/Item.php +++ b/src/Model/Item.php @@ -183,6 +183,10 @@ class Item extends BaseObject Term::insertFromFileFieldByItemId($item['id']); self::deleteThread($item['id'], $item['parent-uri']); + if (!dba::exists('item', ["`uri` = ? AND `uid` != 0 AND NOT `deleted`", $item['uri']])) { + self::delete(['uri' => $item['uri'], 'uid' => 0, 'deleted' => false], $priority); + } + // If it's the parent of a comment thread, kill all the kids if ($item['id'] == $item['parent']) { self::delete(['parent' => $item['parent']], $priority); -- 2.39.5