Fix: Delete all item copies if it is an original item
This commit is contained in:
parent
0848cef605
commit
4a7bf95926
|
@ -112,8 +112,8 @@ class Item extends BaseObject
|
||||||
public static function deleteById($item_id, $priority = PRIORITY_HIGH)
|
public static function deleteById($item_id, $priority = PRIORITY_HIGH)
|
||||||
{
|
{
|
||||||
// locate item to be deleted
|
// locate item to be deleted
|
||||||
$fields = ['id', 'uid', 'parent', 'parent-uri', 'origin', 'deleted',
|
$fields = ['id', 'uri', 'uid', 'parent', 'parent-uri', 'origin',
|
||||||
'file', 'resource-id', 'event-id', 'attach',
|
'deleted', 'file', 'resource-id', 'event-id', 'attach',
|
||||||
'verb', 'object-type', 'object', 'target', 'contact-id'];
|
'verb', 'object-type', 'object', 'target', 'contact-id'];
|
||||||
$item = dba::selectFirst('item', $fields, ['id' => $item_id]);
|
$item = dba::selectFirst('item', $fields, ['id' => $item_id]);
|
||||||
if (!DBM::is_result($item)) {
|
if (!DBM::is_result($item)) {
|
||||||
|
@ -188,8 +188,13 @@ class Item extends BaseObject
|
||||||
self::delete(['parent' => $item['parent']], $priority);
|
self::delete(['parent' => $item['parent']], $priority);
|
||||||
}
|
}
|
||||||
|
|
||||||
// send the notification upstream/downstream
|
// Is it our comment and/or our thread?
|
||||||
if ($item['origin'] || $parent['origin']) {
|
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']));
|
Worker::add(['priority' => $priority, 'dont_fork' => true], "Notifier", "drop", intval($item['id']));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue