]> git.mxchange.org Git - friendica.git/blobdiff - src/Object/Post.php
Space replaced
[friendica.git] / src / Object / Post.php
index 99ab357bc0085e9cfe2ebb9c0b5a0fd48500a916..0f2a0c65182e9adb445ac40b34ebf4d0e5857ddd 100644 (file)
@@ -38,7 +38,6 @@ use Friendica\Model\User;
 use Friendica\Protocol\Activity;
 use Friendica\Util\Crypto;
 use Friendica\Util\DateTimeFormat;
-use Friendica\Util\Proxy as ProxyUtils;
 use Friendica\Util\Strings;
 use Friendica\Util\Temporal;
 
@@ -214,7 +213,7 @@ class Post
                        $pinned = DI::l10n()->t('pinned item');
                }
 
-               if ($origin && ($item['id'] != $item['parent']) && ($item['network'] == Protocol::ACTIVITYPUB)) {
+               if ($origin && ($item['gravity'] != GRAVITY_PARENT) && ($item['network'] == Protocol::ACTIVITYPUB)) {
                        // ActivityPub doesn't allow removal of remote comments
                        $delete = DI::l10n()->t('Delete locally');
                } else {
@@ -380,8 +379,11 @@ class Post
                }
 
                // Disable features that aren't available in several networks
-               if ($buttons["dislike"] && !in_array($item["network"], [Protocol::ACTIVITYPUB, Protocol::DFRN, Protocol::DIASPORA])) {
-                       $buttons["dislike"] = false;
+               if (!in_array($item["network"], [Protocol::ACTIVITYPUB, Protocol::DFRN, Protocol::DIASPORA])) {
+                       if ($buttons["dislike"]) {
+                               $buttons["dislike"] = false;
+                       }
+
                        $isevent = false;
                        $tagger = '';
                }
@@ -390,7 +392,7 @@ class Post
                        $buttons["like"] = false;
                }
 
-               $tags = Tag::populateTagsFromItem($item);
+               $tags = Tag::populateFromItem($item);
 
                $ago = Temporal::getRelativeDate($item['created']);
                $ago_received = Temporal::getRelativeDate($item['received']);
@@ -407,7 +409,9 @@ class Post
                }
 
                $direction = [];
-               if (DI::config()->get('debug', 'show_direction')) {
+               if (!empty($item['direction'])) {
+                       $direction = $item['direction'];
+               } elseif (DI::config()->get('debug', 'show_direction')) {
                        $conversation = DBA::selectFirst('conversation', ['direction'], ['item-uri' => $item['uri']]);
                        if (!empty($conversation['direction']) && in_array($conversation['direction'], [1, 2])) {
                                $title = [1 => DI::l10n()->t('Pushed'), 2 => DI::l10n()->t('Pulled')];
@@ -444,7 +448,7 @@ class Post
                        'profile_url'     => $profile_link,
                        'item_photo_menu' => item_photo_menu($item),
                        'name'            => $name_e,
-                       'thumb'           => DI::baseUrl()->remove(ProxyUtils::proxifyUrl($item['author-avatar'], false, ProxyUtils::SIZE_THUMB)),
+                       'thumb'           => DI::baseUrl()->remove($item['author-avatar']),
                        'osparkle'        => $osparkle,
                        'sparkle'         => $sparkle,
                        'title'           => $title_e,
@@ -458,7 +462,7 @@ class Post
                        'shiny'           => $shiny,
                        'owner_self'      => $item['author-link'] == Session::get('my_url'),
                        'owner_url'       => $this->getOwnerUrl(),
-                       'owner_photo'     => DI::baseUrl()->remove(ProxyUtils::proxifyUrl($item['owner-avatar'], false, ProxyUtils::SIZE_THUMB)),
+                       'owner_photo'     => DI::baseUrl()->remove($item['owner-avatar']),
                        'owner_name'      => $owner_name_e,
                        'plink'           => Item::getPlink($item),
                        'edpost'          => $edpost,
@@ -490,6 +494,7 @@ class Post
                        'received'        => $item['received'],
                        'commented'       => $item['commented'],
                        'created_date'    => $item['created'],
+                       'uriid'           => $item['uri-id'],
                        'return'          => (DI::args()->getCommand()) ? bin2hex(DI::args()->getCommand()) : '',
                        'direction'       => $direction,
                        'delivery'        => [
@@ -872,9 +877,9 @@ class Post
                        $text = '';
                }
 
-               $terms = Tag::ArrayFromURIId($item['uri-id'], [Tag::MENTION, Tag::IMPLICIT_MENTION, Tag::EXCLUSIVE_MENTION]);
+               $terms = Tag::getByURIId($item['uri-id'], [Tag::MENTION, Tag::IMPLICIT_MENTION, Tag::EXCLUSIVE_MENTION]);
                foreach ($terms as $term) {
-                       $profile = Contact::getDetailsByURL($term['url']);
+                       $profile = Contact::getByURL($term['url'], false, ['addr', 'contact-type']);
                        if (!empty($profile['addr']) && ((($profile['contact-type'] ?? '') ?: Contact::TYPE_UNKNOWN) != Contact::TYPE_COMMUNITY) &&
                                ($profile['addr'] != $owner['addr']) && !strstr($text, $profile['addr'])) {
                                $text .= '@' . $profile['addr'] . ' ';