]> git.mxchange.org Git - friendica.git/commitdiff
Fetch the parent only - thread parents only on reshares
authorMichael <heluecht@pirati.ca>
Wed, 17 Aug 2022 19:39:20 +0000 (19:39 +0000)
committerMichael <heluecht@pirati.ca>
Wed, 17 Aug 2022 19:39:20 +0000 (19:39 +0000)
src/Model/Item.php
src/Protocol/Diaspora.php

index d506caaf6808501a6f4e11a8b34489eddefe0349..702c9dee698a8d8d367d2a010249e2237cd77598 100644 (file)
@@ -1522,20 +1522,18 @@ class Item
 
                $causer = $item['causer-id'] ?: $item['author-id'];
 
-               if (($uri_id != $item['parent-uri-id']) && (($item['gravity'] == GRAVITY_COMMENT) || $is_reshare) && !Post::exists(['uri-id' => $item['parent-uri-id'], 'uid' => $uid])) {
+               if (($uri_id != $item['parent-uri-id']) && ($item['gravity'] == GRAVITY_COMMENT) && !Post::exists(['uri-id' => $item['parent-uri-id'], 'uid' => $uid])) {
                        if (!self::fetchParent($item['parent-uri-id'], $uid, $causer)) {
                                Logger::info('Parent post had not been added', ['uri-id' => $item['parent-uri-id'], 'uid' => $uid, 'causer' => $causer]);
                                return 0;
                        }
                        Logger::info('Fetched parent post', ['uri-id' => $item['parent-uri-id'], 'uid' => $uid, 'causer' => $causer]);
-               }
-
-               if (($item['thr-parent-id'] != $item['parent-uri-id']) && ($uri_id != $item['thr-parent-id']) && (($item['gravity'] == GRAVITY_COMMENT) || $is_reshare) && !Post::exists(['uri-id' => $item['thr-parent-id'], 'uid' => $uid])) {
-                       if (!self::fetchParent($item['parent-uri-id'], $uid, $causer)) {
-                               Logger::info('Thread parent had not been added', ['uri-id' => $item['parent-uri-id'], 'uid' => $uid, 'causer' => $causer]);
+               } elseif (($uri_id != $item['thr-parent-id']) && $is_reshare && !Post::exists(['uri-id' => $item['thr-parent-id'], 'uid' => $uid])) {
+                       if (!self::fetchParent($item['thr-parent-id'], $uid, $causer)) {
+                               Logger::info('Thread parent had not been added', ['uri-id' => $item['thr-parent-id'], 'uid' => $uid, 'causer' => $causer]);
                                return 0;
                        }
-                       Logger::info('Fetched thread parent', ['uri-id' => $item['parent-uri-id'], 'uid' => $uid, 'causer' => $causer]);
+                       Logger::info('Fetched thread parent', ['uri-id' => $item['thr-parent-id'], 'uid' => $uid, 'causer' => $causer]);
                }
 
                $stored = self::storeForUser($item, $uid);
index 045992333ea8bd316a28e2d8236330de9698d9c8..d40d548350eff5eb899bebba2589ba0582956548 100644 (file)
@@ -3992,7 +3992,7 @@ class Diaspora
                                $data['birthday'] = DateTimeFormat::utc($year . '-' . $month . '-' . $day, 'Y-m-d');
                        }
 
-                       $data['about'] = BBCode::toMarkdown($profile['about']);
+                       $data['about'] = BBCode::toMarkdown($profile['about'] ?? '');
 
                        $data['location'] = $profile['location'];
                        $data['tag_string'] = '';