Use new function to check for a local avatar cache file

This commit is contained in:
Michael 2022-05-08 10:32:29 +00:00
parent 805dc8e6bd
commit f220e26f00
3 changed files with 44 additions and 11 deletions

View file

@ -123,8 +123,8 @@ class Post
/**
* Fetch the privacy of the post
*
* @param array $item
* @return string
* @param array $item
* @return string
*/
private function fetchPrivacy(array $item):string
{
@ -453,11 +453,22 @@ class Post
if (in_array($item['network'], [Protocol::FEED, Protocol::MAIL])) {
$owner_avatar = $author_avatar = $item['contact-id'];
$owner_updated = $author_updated = '';
$owner_thumb = $author_thumb = $item['contact-avatar'];
} else {
$owner_avatar = $item['owner-id'];
$owner_updated = $item['owner-updated'];
$owner_thumb = $item['owner-avatar'];
$author_avatar = $item['author-id'];
$author_updated = $item['author-updated'];
$author_thumb = $item['author-avatar'];
}
if (!Contact::isAvatarFile($owner_thumb)) {
$owner_thumb = Contact::getAvatarUrlForId($owner_avatar, Proxy::SIZE_THUMB, $owner_updated);
}
if (!Contact::isAvatarFile($author_thumb)) {
$author_thumb = Contact::getAvatarUrlForId($author_avatar, Proxy::SIZE_THUMB, $author_updated);
}
$tmp_item = [
@ -491,7 +502,7 @@ class Post
'profile_url' => $profile_link,
'name' => $profile_name,
'item_photo_menu_html' => DI::contentItem()->photoMenu($item, $formSecurityToken),
'thumb' => DI::baseUrl()->remove(Contact::getAvatarUrlForId($author_avatar, Proxy::SIZE_THUMB, $author_updated)),
'thumb' => DI::baseUrl()->remove($author_thumb),
'osparkle' => $osparkle,
'sparkle' => $sparkle,
'title' => $title,
@ -508,7 +519,7 @@ class Post
'shiny' => $shiny,
'owner_self' => $item['author-link'] == Session::get('my_url'),
'owner_url' => $this->getOwnerUrl(),
'owner_photo' => DI::baseUrl()->remove(Contact::getAvatarUrlForId($owner_avatar, Proxy::SIZE_THUMB, $owner_updated)),
'owner_photo' => DI::baseUrl()->remove($owner_thumb),
'owner_name' => $this->getOwnerName(),
'plink' => Item::getPlink($item),
'browsershare' => $browsershare,