mirror of
https://github.com/friendica/friendica
synced 2024-11-09 16:22:56 +00:00
Unarchive inboxes on profile update
This commit is contained in:
parent
198e150ba8
commit
18f3ff7b8e
1 changed files with 26 additions and 0 deletions
|
@ -123,11 +123,14 @@ class APContact extends BaseObject
|
|||
$apcontact['following'] = JsonLD::fetchElement($compacted, 'as:following', '@id');
|
||||
$apcontact['followers'] = JsonLD::fetchElement($compacted, 'as:followers', '@id');
|
||||
$apcontact['inbox'] = JsonLD::fetchElement($compacted, 'ldp:inbox', '@id');
|
||||
self::unarchiveInbox($apcontact['inbox']);
|
||||
|
||||
$apcontact['outbox'] = JsonLD::fetchElement($compacted, 'as:outbox', '@id');
|
||||
|
||||
$apcontact['sharedinbox'] = '';
|
||||
if (!empty($compacted['as:endpoints'])) {
|
||||
$apcontact['sharedinbox'] = JsonLD::fetchElement($compacted['as:endpoints'], 'as:sharedInbox', '@id');
|
||||
self::unarchiveInbox($apcontact['sharedinbox']);
|
||||
}
|
||||
|
||||
$apcontact['nick'] = JsonLD::fetchElement($compacted, 'as:preferredUsername');
|
||||
|
@ -231,4 +234,27 @@ class APContact extends BaseObject
|
|||
|
||||
return $apcontact;
|
||||
}
|
||||
|
||||
/**
|
||||
* Unarchive inboxes
|
||||
*
|
||||
* @param string $url inbox url
|
||||
*/
|
||||
private static function unarchiveInbox($url)
|
||||
{
|
||||
if (empty($url)) {
|
||||
return;
|
||||
}
|
||||
|
||||
$now = DateTimeFormat::utcNow();
|
||||
|
||||
if (!DBA::exists('inbox-status', ['url' => $url])) {
|
||||
$fields = ['archive' => false, 'success' => $now,
|
||||
'url' => $url, 'created' => $now];
|
||||
DBA::insert('inbox-status', $fields);
|
||||
} else {
|
||||
$fields = ['archive' => false, 'success' => $now];
|
||||
DBA::update('inbox-status', $fields, ['url' => $url]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue