From 44cc750f79bcf18d6886382c52e8d24d6963c3df Mon Sep 17 00:00:00 2001 From: Michael Date: Thu, 31 Oct 2019 07:33:25 +0000 Subject: [PATCH] Some more warnings removed --- src/Model/GContact.php | 24 ++++++++++++++---------- src/Protocol/Diaspora.php | 4 ++-- src/Worker/Notifier.php | 1 + 3 files changed, 17 insertions(+), 12 deletions(-) diff --git a/src/Model/GContact.php b/src/Model/GContact.php index 19d27109ea..493d67f024 100644 --- a/src/Model/GContact.php +++ b/src/Model/GContact.php @@ -809,14 +809,11 @@ class GContact return; } - // When the profile doesn't have got a feed, then we exit here - if (empty($data['poll'])) { - return; - } - - if ($data['network'] == Protocol::ACTIVITYPUB) { + if (!empty($data['outbox'])) { + self::updateFromOutbox($data['outbox'], $data); + } elseif (!empty($data['poll']) && ($data['network'] == Protocol::ACTIVITYPUB)) { self::updateFromOutbox($data['poll'], $data); - } else { + } elseif (!empty($data['poll'])) { self::updateFromFeed($data); } } @@ -885,10 +882,17 @@ class GContact } $last_updated = ''; - foreach ($items as $activity) { - if ($last_updated < $activity['published']) { - $last_updated = $activity['published']; + if (!empty($activity['published'])) { + $published = DateTimeFormat::utc($activity['published']); + } elseif (!empty($activity['object']['published'])) { + $published = DateTimeFormat::utc($activity['object']['published']); + } else { + continue; + } + + if ($last_updated < $published) { + $last_updated = $published; } } diff --git a/src/Protocol/Diaspora.php b/src/Protocol/Diaspora.php index dc02366cb1..3b283504cc 100644 --- a/src/Protocol/Diaspora.php +++ b/src/Protocol/Diaspora.php @@ -176,7 +176,7 @@ class Diaspora * @return array with the contact * @throws \Exception */ - private static function getRelayContact(string $server_url, array $fields = ['batch', 'id', 'name', 'network', 'protocol', 'archive', 'blocked']) + private static function getRelayContact(string $server_url, array $fields = ['batch', 'id', 'url', 'name', 'network', 'protocol', 'archive', 'blocked']) { // Fetch the relay contact $condition = ['uid' => 0, 'nurl' => Strings::normaliseLink($server_url), @@ -250,7 +250,7 @@ class Diaspora */ public static function participantsForThread($thread, array $contacts) { - $r = DBA::p("SELECT `contact`.`batch`, `contact`.`id`, `contact`.`name`, `contact`.`network`, `contact`.`protocol`, + $r = DBA::p("SELECT `contact`.`batch`, `contact`.`id`, `contact`.`url`, `contact`.`name`, `contact`.`network`, `contact`.`protocol`, `fcontact`.`batch` AS `fbatch`, `fcontact`.`network` AS `fnetwork` FROM `participation` INNER JOIN `contact` ON `contact`.`id` = `participation`.`cid` INNER JOIN `fcontact` ON `fcontact`.`id` = `participation`.`fid` diff --git a/src/Worker/Notifier.php b/src/Worker/Notifier.php index 80ced8acce..9ab07e6d49 100644 --- a/src/Worker/Notifier.php +++ b/src/Worker/Notifier.php @@ -404,6 +404,7 @@ class Notifier "SELECT `batch`, ANY_VALUE(`id`) AS `id`, + ANY_VALUE(`url`) AS `url`, ANY_VALUE(`name`) AS `name`, ANY_VALUE(`network`) AS `network`, ANY_VALUE(`protocol`) AS `protocol`