]> git.mxchange.org Git - friendica.git/commitdiff
Fix: Delete all item copies if it is an original item
authorMichael <heluecht@pirati.ca>
Tue, 15 May 2018 15:51:58 +0000 (15:51 +0000)
committerMichael <heluecht@pirati.ca>
Tue, 15 May 2018 15:51:58 +0000 (15:51 +0000)
src/Model/Item.php

index ab291a3306dd1f9372b1e7981fc8e0d496139cc7..10e5f9e8e2609d1a325c09f921f70f1704fbb2a3 100644 (file)
@@ -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']));
                }