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);
}
}
}
$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;
}
}
* @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),
*/
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`
"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`