From 418009ffea8f9eed127e568a6069ae00c4ee5685 Mon Sep 17 00:00:00 2001 From: Michael Date: Fri, 2 Aug 2019 16:46:26 +0000 Subject: [PATCH 1/2] Improved PR 7452: We now respect the "self" contact --- src/Model/Item.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Model/Item.php b/src/Model/Item.php index 248e646af..ef461fe65 100644 --- a/src/Model/Item.php +++ b/src/Model/Item.php @@ -1234,7 +1234,9 @@ class Item extends BaseObject private static function contactId($item) { - if (!empty($item['uid']) && !Contact::isSharing($item['author-id'], $item['uid'])) { + if (!empty($item['contact-id']) && DBA::exists('contact', ['self' => true, 'id' => $item['contact-id']])) { + return $item['contact-id']; + } elseif (!empty($item['uid']) && !Contact::isSharing($item['author-id'], $item['uid'])) { return $item['author-id']; } elseif (!empty($item['contact-id'])) { return $item['contact-id']; From bcadf19289ca9a5d94f1442e6d0d6780f8c39029 Mon Sep 17 00:00:00 2001 From: Michael Date: Fri, 2 Aug 2019 17:17:51 +0000 Subject: [PATCH 2/2] "contact-id" has to be set, after "author-id" had been set --- src/Model/Item.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Model/Item.php b/src/Model/Item.php index 01c2c3459..de500bd56 100644 --- a/src/Model/Item.php +++ b/src/Model/Item.php @@ -1471,9 +1471,6 @@ class Item extends BaseObject $item['plink'] = defaults($item, 'plink', System::baseUrl() . '/display/' . urlencode($item['guid'])); - // The contact-id should be set before "self::insert" was called - but there seems to be issues sometimes - $item["contact-id"] = self::contactId($item); - $default = ['url' => $item['author-link'], 'name' => $item['author-name'], 'photo' => $item['author-avatar'], 'network' => $item['network']]; @@ -1529,6 +1526,9 @@ class Item extends BaseObject unset($item['causer-id']); unset($item['causer-link']); + // The contact-id should be set before "self::insert" was called - but there seems to be issues sometimes + $item["contact-id"] = self::contactId($item); + if ($item['network'] == Protocol::PHANTOM) { $item['network'] = Protocol::DFRN; Logger::notice('Missing network, setting to {network}.', [