]> git.mxchange.org Git - friendica.git/blobdiff - src/Object/Post.php
Some more places changed to the new contact avatar path format
[friendica.git] / src / Object / Post.php
index d8d210e65cbc5ee58b05e16c6ea35e6c7609ec13..089556a1fa038b361e430f93d1b74f1ce1cead02 100644 (file)
@@ -39,6 +39,7 @@ use Friendica\Model\User;
 use Friendica\Protocol\Activity;
 use Friendica\Util\Crypto;
 use Friendica\Util\DateTimeFormat;
+use Friendica\Util\Proxy;
 use Friendica\Util\Strings;
 use Friendica\Util\Temporal;
 
@@ -68,7 +69,6 @@ class Post
        private $thread = null;
        private $redirect_url = null;
        private $owner_url = '';
-       private $owner_photo = '';
        private $owner_name = '';
        private $wall_to_wall = false;
        private $threaded = false;
@@ -211,7 +211,7 @@ class Post
                $origin = $item['origin'] || $item['parent-origin'];
 
                if ($item['pinned']) {
-                       $pinned = DI::l10n()->t('pinned item');
+                       $pinned = DI::l10n()->t('Pinned item');
                }
 
                // Showing the one or the other text, depending upon if we can only hide it or really delete it.
@@ -236,7 +236,7 @@ class Post
                        ];
                }
 
-               $filer = (($conv->getProfileOwner() == local_user() && ($item['uid'] != 0)) ? DI::l10n()->t("save to folder") : false);
+               $filer = (($conv->getProfileOwner() == local_user() && ($item['uid'] != 0)) ? DI::l10n()->t('Save to folder') : false);
 
                $profile_name = $item['author-name'];
                if (!empty($item['author-link']) && empty($item['author-name'])) {
@@ -300,12 +300,12 @@ class Post
                                $ignored = PostModel\ThreadUser::getIgnored($item['uri-id'], local_user());
                                if ($item['mention'] || $ignored) {
                                        $ignore = [
-                                               'do'        => DI::l10n()->t("ignore thread"),
-                                               'undo'      => DI::l10n()->t("unignore thread"),
-                                               'toggle'    => DI::l10n()->t("toggle ignore status"),
+                                               'do'        => DI::l10n()->t('Ignore thread'),
+                                               'undo'      => DI::l10n()->t('Unignore thread'),
+                                               'toggle'    => DI::l10n()->t('Toggle ignore status'),
                                                'classdo'   => $ignored ? "hidden" : "",
                                                'classundo' => $ignored ? "" : "hidden",
-                                               'ignored'   => DI::l10n()->t('ignored'),
+                                               'ignored'   => DI::l10n()->t('Ignored'),
                                        ];
                                }
 
@@ -314,28 +314,28 @@ class Post
                                                $ispinned = ($item['pinned'] ? 'pinned' : 'unpinned');
 
                                                $pin = [
-                                                       'do'        => DI::l10n()->t('pin'),
-                                                       'undo'      => DI::l10n()->t('unpin'),
-                                                       'toggle'    => DI::l10n()->t('toggle pin status'),
+                                                       'do'        => DI::l10n()->t('Pin'),
+                                                       'undo'      => DI::l10n()->t('Unpin'),
+                                                       'toggle'    => DI::l10n()->t('Toggle pin status'),
                                                        'classdo'   => $item['pinned'] ? 'hidden' : '',
                                                        'classundo' => $item['pinned'] ? '' : 'hidden',
-                                                       'pinned'   => DI::l10n()->t('pinned'),
+                                                       'pinned'   => DI::l10n()->t('Pinned'),
                                                ];
                                        }
 
                                        $isstarred = (($item['starred']) ? "starred" : "unstarred");
 
                                        $star = [
-                                               'do'        => DI::l10n()->t("add star"),
-                                               'undo'      => DI::l10n()->t("remove star"),
-                                               'toggle'    => DI::l10n()->t("toggle star status"),
+                                               'do'        => DI::l10n()->t('Add star'),
+                                               'undo'      => DI::l10n()->t('Remove star'),
+                                               'toggle'    => DI::l10n()->t('Toggle star status'),
                                                'classdo'   => $item['starred'] ? "hidden" : "",
                                                'classundo' => $item['starred'] ? "" : "hidden",
-                                               'starred'   => DI::l10n()->t('starred'),
+                                               'starred'   => DI::l10n()->t('Starred'),
                                        ];
 
                                        $tagger = [
-                                               'add'   => DI::l10n()->t("add tag"),
+                                               'add'   => DI::l10n()->t('Add tag'),
                                                'class' => "",
                                        ];
                                }
@@ -345,8 +345,8 @@ class Post
                }
 
                if ($conv->isWritable()) {
-                       $buttons['like']    = [DI::l10n()->t("I like this \x28toggle\x29")      , DI::l10n()->t("like")];
-                       $buttons['dislike'] = [DI::l10n()->t("I don't like this \x28toggle\x29"), DI::l10n()->t("dislike")];
+                       $buttons['like']    = [DI::l10n()->t("I like this \x28toggle\x29")      , DI::l10n()->t('Like')];
+                       $buttons['dislike'] = [DI::l10n()->t("I don't like this \x28toggle\x29"), DI::l10n()->t('Dislike')];
                        if ($shareable) {
                                $buttons['share'] = [DI::l10n()->t('Quote share this'), DI::l10n()->t('Quote Share')];
                        }
@@ -401,9 +401,13 @@ class Post
                }
 
                // Fetching of Diaspora posts doesn't always work. There are issues with reshares and possibly comments
-               if (($item['network'] != Protocol::DIASPORA) && empty($comment) && !empty(Session::get('remote_comment'))) {
-                       $remote_comment = [DI::l10n()->t('Comment this item on your system'), DI::l10n()->t('remote comment'),
+               if (!local_user() && ($item['network'] != Protocol::DIASPORA) && !empty(Session::get('remote_comment'))) {
+                       $remote_comment = [DI::l10n()->t('Comment this item on your system'), DI::l10n()->t('Remote comment'),
                                str_replace('{uri}', urlencode($item['uri']), Session::get('remote_comment'))];
+
+                       // Ensure to either display the remote comment or the local activities
+                       $buttons = [];
+                       $comment_html = '';
                } else {
                        $remote_comment = '';
                }
@@ -455,7 +459,7 @@ class Post
                        'profile_url'     => $profile_link,
                        'name'            => $profile_name,
                        'item_photo_menu_html' => item_photo_menu($item),
-                       'thumb'           => DI::baseUrl()->remove($item['author-avatar']),
+                       'thumb'           => DI::baseUrl()->remove(Contact::getAvatarUrlForUrl($item['author-link'], $item['uid'], Proxy::SIZE_THUMB)),
                        'osparkle'        => $osparkle,
                        'sparkle'         => $sparkle,
                        'title'           => $title,
@@ -469,7 +473,7 @@ class Post
                        'shiny'           => $shiny,
                        'owner_self'      => $item['author-link'] == Session::get('my_url'),
                        'owner_url'       => $this->getOwnerUrl(),
-                       'owner_photo'     => DI::baseUrl()->remove($item['owner-avatar']),
+                       'owner_photo'     => DI::baseUrl()->remove(Contact::getAvatarUrlForUrl($item['owner-link'], $item['uid'], Proxy::SIZE_THUMB)),
                        'owner_name'      => $this->getOwnerName(),
                        'plink'           => Item::getPlink($item),
                        'edpost'          => $edpost,
@@ -1002,7 +1006,6 @@ class Post
                                        // Put this person as the wall owner of the wall-to-wall notice.
 
                                        $this->owner_url = Contact::magicLinkByContact($a->page_contact);
-                                       $this->owner_photo = $a->page_contact['thumb'];
                                        $this->owner_name = $a->page_contact['name'];
                                        $this->wall_to_wall = true;
                                } elseif ($this->getDataValue('owner-link')) {
@@ -1020,7 +1023,6 @@ class Post
                                                // But it could be somebody else with the same name. It just isn't highly likely.
 
 
-                                               $this->owner_photo = $this->getDataValue('owner-avatar');
                                                $this->owner_name = $this->getDataValue('owner-name');
                                                $this->wall_to_wall = true;
 
@@ -1036,7 +1038,6 @@ class Post
                if (!$this->wall_to_wall) {
                        $this->setTemplate('wall');
                        $this->owner_url = '';
-                       $this->owner_photo = '';
                        $this->owner_name = '';
                }
        }