]> git.mxchange.org Git - friendica.git/blobdiff - src/Object/Post.php
Merge pull request #11669 from MrPetovan/bug/11666-email-subject-double-encode
[friendica.git] / src / Object / Post.php
index 0a7bea91bdd0457517d93d3d0bbccc4f46d5cc21..4c5aa8a21b27b60749de8b42a21503d68e4cb85a 100644 (file)
@@ -32,6 +32,7 @@ use Friendica\Core\Session;
 use Friendica\DI;
 use Friendica\Model\Contact;
 use Friendica\Model\Item;
+use Friendica\Model\Photo;
 use Friendica\Model\Post as PostModel;
 use Friendica\Model\Tag;
 use Friendica\Model\User;
@@ -341,7 +342,7 @@ class Post
                                ];
 
                                if ($conv->getProfileOwner() == local_user() && ($item['uid'] != 0)) {
-                                       if ($origin) {
+                                       if ($origin && in_array($item['private'], [Item::PUBLIC, Item::UNLISTED])) {
                                                $ispinned = ($item['featured'] ? 'pinned' : 'unpinned');
 
                                                $pin = [
@@ -450,27 +451,6 @@ class Post
                        $browsershare = null;
                }
 
-               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 = [
                        'template'        => $this->getTemplate(),
                        'type'            => implode("", array_slice(explode("/", $item['verb']), -1)),
@@ -502,7 +482,7 @@ class Post
                        'profile_url'     => $profile_link,
                        'name'            => $profile_name,
                        'item_photo_menu_html' => DI::contentItem()->photoMenu($item, $formSecurityToken),
-                       'thumb'           => DI::baseUrl()->remove($author_thumb),
+                       'thumb'           => DI::baseUrl()->remove(DI::contentItem()->getAuthorAvatar($item)),
                        'osparkle'        => $osparkle,
                        'sparkle'         => $sparkle,
                        'title'           => $title,
@@ -519,7 +499,7 @@ class Post
                        'shiny'           => $shiny,
                        'owner_self'      => $item['author-link'] == Session::get('my_url'),
                        'owner_url'       => $this->getOwnerUrl(),
-                       'owner_photo'     => DI::baseUrl()->remove($owner_thumb),
+                       'owner_photo'     => DI::baseUrl()->remove(DI::contentItem()->getOwnerAvatar($item)),
                        'owner_name'      => $this->getOwnerName(),
                        'plink'           => Item::getPlink($item),
                        'browsershare'    => $browsershare,
@@ -1028,7 +1008,7 @@ class Post
        /**
         * @return string
         */
-       private function getRedirectUrl()
+       private function getRedirectUrl(): string
        {
                return $this->redirect_url;
        }