Fix avatar for messages and feeds
This commit is contained in:
parent
4a5d230aad
commit
50a0034744
|
@ -308,7 +308,7 @@ function message_content(App $a)
|
||||||
$body_e = BBCode::convertForUriId($message['uri-id'], $message['body']);
|
$body_e = BBCode::convertForUriId($message['uri-id'], $message['body']);
|
||||||
$to_name_e = $message['name'];
|
$to_name_e = $message['name'];
|
||||||
|
|
||||||
$contact = Contact::getByURL($message['from-url'], false, ['thumb', 'addr', 'id', 'avatar']);
|
$contact = Contact::getByURL($message['from-url'], false, ['thumb', 'addr', 'id', 'avatar', 'url']);
|
||||||
$from_photo = Contact::getThumb($contact);
|
$from_photo = Contact::getThumb($contact);
|
||||||
|
|
||||||
$mails[] = [
|
$mails[] = [
|
||||||
|
@ -440,7 +440,7 @@ function render_messages(array $msg, $t)
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
$contact = Contact::getByURL($rr['url'], false, ['thumb', 'addr', 'id', 'avatar']);
|
$contact = Contact::getByURL($rr['url'], false, ['thumb', 'addr', 'id', 'avatar', 'url']);
|
||||||
$from_photo = Contact::getThumb($contact);
|
$from_photo = Contact::getThumb($contact);
|
||||||
|
|
||||||
$rslt .= Renderer::replaceMacros($tpl, [
|
$rslt .= Renderer::replaceMacros($tpl, [
|
||||||
|
|
|
@ -62,17 +62,23 @@ class VCard
|
||||||
$unfollow_link = '';
|
$unfollow_link = '';
|
||||||
$wallmessage_link = '';
|
$wallmessage_link = '';
|
||||||
|
|
||||||
|
$photo = Contact::getPhoto($contact);
|
||||||
|
|
||||||
if (local_user()) {
|
if (local_user()) {
|
||||||
if ($contact['uid']) {
|
if ($contact['uid']) {
|
||||||
$id = $contact['id'];
|
$id = $contact['id'];
|
||||||
$rel = $contact['rel'];
|
$rel = $contact['rel'];
|
||||||
$pending = $contact['pending'];
|
$pending = $contact['pending'];
|
||||||
} else {
|
} else {
|
||||||
$pcontact = Contact::selectFirst(['id', 'rel', 'pending'], ['uid' => local_user(), 'uri-id' => $contact['uri-id']]);
|
$pcontact = Contact::selectFirst([], ['uid' => local_user(), 'uri-id' => $contact['uri-id']]);
|
||||||
|
|
||||||
$id = $pcontact['id'] ?? 0;
|
$id = $pcontact['id'] ?? 0;
|
||||||
$rel = $pcontact['rel'] ?? Contact::NOTHING;
|
$rel = $pcontact['rel'] ?? Contact::NOTHING;
|
||||||
$pending = $pcontact['pending'] ?? false;
|
$pending = $pcontact['pending'] ?? false;
|
||||||
|
|
||||||
|
if (!empty($pcontact) && in_array($pcontact['network'], [Protocol::MAIL, Protocol::FEED])) {
|
||||||
|
$photo = Contact::getPhoto($pcontact);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (empty($contact['self']) && Protocol::supportsFollow($contact['network'])) {
|
if (empty($contact['self']) && Protocol::supportsFollow($contact['network'])) {
|
||||||
|
@ -90,7 +96,7 @@ class VCard
|
||||||
|
|
||||||
return Renderer::replaceMacros(Renderer::getMarkupTemplate('widget/vcard.tpl'), [
|
return Renderer::replaceMacros(Renderer::getMarkupTemplate('widget/vcard.tpl'), [
|
||||||
'$contact' => $contact,
|
'$contact' => $contact,
|
||||||
'$photo' => Contact::getPhoto($contact),
|
'$photo' => $photo,
|
||||||
'$url' => Contact::magicLinkByContact($contact, $contact['url']),
|
'$url' => Contact::magicLinkByContact($contact, $contact['url']),
|
||||||
'$about' => BBCode::convertForUriId($contact['uri-id'] ?? 0, $contact['about'] ?? ''),
|
'$about' => BBCode::convertForUriId($contact['uri-id'] ?? 0, $contact['about'] ?? ''),
|
||||||
'$xmpp' => DI::l10n()->t('XMPP:'),
|
'$xmpp' => DI::l10n()->t('XMPP:'),
|
||||||
|
|
Loading…
Reference in a new issue