1
1
Fork 0

AP: Avoid an empty avatar field

This commit is contained in:
Michael 2018-10-08 03:28:49 +00:00
parent 3bccaccede
commit 4047952703

View file

@ -209,12 +209,17 @@ class Transmitter
return []; return [];
} }
$fields = ['name', 'url', 'location', 'about', 'avatar']; $fields = ['name', 'url', 'location', 'about', 'avatar', 'photo'];
$contact = DBA::selectFirst('contact', $fields, ['uid' => $uid, 'self' => true]); $contact = DBA::selectFirst('contact', $fields, ['uid' => $uid, 'self' => true]);
if (!DBA::isResult($contact)) { if (!DBA::isResult($contact)) {
return []; return [];
} }
// On old installations and never changed contacts this might not be filled
if (empty($contact['avatar'])) {
$contact['avatar'] = $contact['photo'];
}
$data = ['@context' => ActivityPub::CONTEXT]; $data = ['@context' => ActivityPub::CONTEXT];
$data['id'] = $contact['url']; $data['id'] = $contact['url'];
$data['diaspora:guid'] = $user['guid']; $data['diaspora:guid'] = $user['guid'];