From 531085890aa1a7fc00c658a972c04f973887ba82 Mon Sep 17 00:00:00 2001 From: Michael Date: Wed, 17 Aug 2022 19:39:20 +0000 Subject: [PATCH] Fetch the parent only - thread parents only on reshares --- src/Model/Item.php | 12 +++++------- src/Protocol/Diaspora.php | 2 +- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/src/Model/Item.php b/src/Model/Item.php index d506caaf68..702c9dee69 100644 --- a/src/Model/Item.php +++ b/src/Model/Item.php @@ -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); diff --git a/src/Protocol/Diaspora.php b/src/Protocol/Diaspora.php index 045992333e..d40d548350 100644 --- a/src/Protocol/Diaspora.php +++ b/src/Protocol/Diaspora.php @@ -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'] = '';