]> git.mxchange.org Git - friendica.git/blobdiff - src/Content/Conversation.php
Remove DI dependency in Object\Api\Mastodon\Instance
[friendica.git] / src / Content / Conversation.php
index 5a32bf32f264eaa950c5f8b209abaecd5e6b6191..517a364b6e71840b8de299ab004df5275f406e17 100644 (file)
@@ -251,19 +251,21 @@ class Conversation
        /**
         * Format the activity text for an item/photo/video
         *
-        * @param array  $links = array of pre-linked names of actors
-        * @param string $verb  = one of 'like, 'dislike', 'attendyes', 'attendno', 'attendmaybe'
-        * @param int    $id    = item id
+        * @param array  $links    array of pre-linked names of actors
+        * @param string $verb     one of 'like, 'dislike', 'attendyes', 'attendno', 'attendmaybe'
+        * @param int    $id       item id
+        * @param string $activity Activity URI
+        * @param array  $emojis   Array with emoji reactions
         * @return string formatted text
         * @throws \Friendica\Network\HTTPException\InternalServerErrorException
         */
-       public function formatActivity(array $links, string $verb, int $id): string
+       public function formatActivity(array $links, string $verb, int $id, string $activity, array $emojis): string
        {
                $this->profiler->startRecording('rendering');
                $expanded = '';
 
                $phrase = $this->getLikerPhrase($verb, $links);
-               $total  = count($links);
+               $total  = max(count($links), $emojis[$activity]['total'] ?? 0);
 
                if ($total > 1) {
                        $spanatts  = "class=\"btn btn-link fakelink\" onclick=\"openClose('{$verb}list-$id');\"";
@@ -567,7 +569,7 @@ class Conversation
                        $live_update_div = '<div id="live-search"></div>' . "\r\n";
                }
 
-               $page_dropping = $this->session->getLocalUserId() && $this->session->getLocalUserId() == $uid && $mode != self::MODE_SEARCH;
+               $page_dropping = $this->session->getLocalUserId() && $this->pConfig->get($this->session->getLocalUserId(), 'system', 'show_page_drop', true) && ($this->session->getLocalUserId() == $uid && $mode != self::MODE_SEARCH);
 
                if (!$update) {
                        $_SESSION['return_path'] = $this->args->getQueryString();
@@ -889,9 +891,10 @@ class Conversation
                        $condition['author-hidden'] = false;
                }
 
-               if ($this->config->get('system', 'emoji_activities')) {
-                       $emojis      = $this->getEmojis($uriids);
-                       $quoteshares = $this->getQuoteShares($uriids);
+               $emojis      = $this->getEmojis($uriids);
+               $quoteshares = $this->getQuoteShares($uriids);
+
+               if (!$this->config->get('system', 'legacy_activities')) {
                        $condition = DBA::mergeConditions($condition, ["(`gravity` != ? OR `origin`)", ItemModel::GRAVITY_ACTIVITY]);
                }