]> git.mxchange.org Git - friendica.git/commitdiff
Setting the post reason and causer
authorMichael <heluecht@pirati.ca>
Wed, 26 May 2021 14:21:28 +0000 (14:21 +0000)
committerMichael <heluecht@pirati.ca>
Wed, 26 May 2021 14:21:28 +0000 (14:21 +0000)
src/Model/Item.php

index 5f0c4c8ed4d28bce85b8e847bb2bd62315b1b2e5..db75030477642dc15d8b6a9804635fb658395012 100644 (file)
@@ -1386,8 +1386,9 @@ class Item
 
                if ((($item['gravity'] == GRAVITY_COMMENT) || $is_reshare) && !Post::exists(['uri-id' => $item['thr-parent-id'], 'uid' => $uid])) {
                        // Only do an auto complete with the source uid "0" to prevent privavy problems
-                       $result = self::storeForUserByUriId($item['thr-parent-id'], $uid);
-                       Logger::info('Fetched thread parent', ['uri-id' => $item['thr-parent-id'], 'uid' => $uid, 'result' => $result]);
+                       $causer = $item['causer-id'] ?: $item['author-id'];
+                       $result = self::storeForUserByUriId($item['thr-parent-id'], $uid, ['causer-id' => $causer, 'post-reason' => self::PR_FETCHED]);
+                       Logger::info('Fetched thread parent', ['uri-id' => $item['thr-parent-id'], 'uid' => $uid, 'causer' => $causer, 'result' => $result]);
                }
 
                $stored = self::storeForUser($item, $uid);
@@ -1420,12 +1421,9 @@ class Item
                unset($item['pubmail']);
                unset($item['forum_mode']);
 
-               //unset($item['post-reason']);
-               //unset($item['protocol']);
                unset($item['event-id']);
                unset($item['hidden']);
                unset($item['notification-type']);
-               //unset($item['resource-id']);
 
                $item['uid'] = $uid;
                $item['origin'] = 0;