Delete the shadow post when it is the last one

This commit is contained in:
Michael 2018-05-15 16:40:13 +00:00
parent 4a7bf95926
commit 3e475f3b82
1 changed files with 4 additions and 0 deletions

View File

@ -183,6 +183,10 @@ class Item extends BaseObject
Term::insertFromFileFieldByItemId($item['id']); Term::insertFromFileFieldByItemId($item['id']);
self::deleteThread($item['id'], $item['parent-uri']); 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 it's the parent of a comment thread, kill all the kids
if ($item['id'] == $item['parent']) { if ($item['id'] == $item['parent']) {
self::delete(['parent' => $item['parent']], $priority); self::delete(['parent' => $item['parent']], $priority);