From 4047952703b4bb41d934e6e4cf758948dc5c84af Mon Sep 17 00:00:00 2001 From: Michael Date: Mon, 8 Oct 2018 03:28:49 +0000 Subject: [PATCH] AP: Avoid an empty avatar field --- src/Protocol/ActivityPub/Transmitter.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/Protocol/ActivityPub/Transmitter.php b/src/Protocol/ActivityPub/Transmitter.php index 26467e68f8..476c63a58f 100644 --- a/src/Protocol/ActivityPub/Transmitter.php +++ b/src/Protocol/ActivityPub/Transmitter.php @@ -209,12 +209,17 @@ class Transmitter return []; } - $fields = ['name', 'url', 'location', 'about', 'avatar']; + $fields = ['name', 'url', 'location', 'about', 'avatar', 'photo']; $contact = DBA::selectFirst('contact', $fields, ['uid' => $uid, 'self' => true]); if (!DBA::isResult($contact)) { 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['id'] = $contact['url']; $data['diaspora:guid'] = $user['guid'];