$contact['about'] = $contact['about'] ?? '';
$contact['generation'] = $contact['generation'] ?? 0;
- $fields = ['name' => $contact['name'], 'nick' => $contact['nick'], 'addr' => $contact['addr'], 'network' => $contact['network'],
+ $fields = ['name' => $contact['name'], 'nick' => $contact['nick'] ?? '', 'addr' => $contact['addr'] ?? '', 'network' => $contact['network'],
'url' => $contact['url'], 'nurl' => Strings::normaliseLink($contact['url']), 'photo' => $contact['photo'],
'created' => DateTimeFormat::utcNow(), 'updated' => DateTimeFormat::utcNow(), 'location' => $contact['location'],
'about' => $contact['about'], 'hide' => $contact['hide'], 'generation' => $contact['generation']];
+
DBA::insert('gcontact', $fields);
$condition = ['nurl' => Strings::normaliseLink($contact['url'])];
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;
}
}