]> git.mxchange.org Git - friendica.git/blobdiff - src/Object/Post.php
Unneeded logging removed
[friendica.git] / src / Object / Post.php
index ed0e2977c77fdfdfd5370697c35d8d2a89147c9e..d52a05dddcf990aa76b029aa4c9584bb1c6959a2 100644 (file)
@@ -351,7 +351,7 @@ class Post
                foreach ($response_verbs as $value => $verb) {
                        $responses[$verb] = [
                                'self'   => $conv_responses[$verb][$item['uri-id']]['self'] ?? 0,
-                               'output' => !empty($conv_responses[$verb][$item['uri-id']]) ? DI::conversation()->formatActivity($conv_responses[$verb][$item['uri-id']]['links'], $verb, $item['uri-id']) : '',
+                               'output' => !empty($conv_responses[$verb][$item['uri-id']]) ? DI::conversation()->formatActivity($conv_responses[$verb][$item['uri-id']]['links'], $verb, $item['uri-id'], $verbs[$verb], $emojis) : '',
                                'total'  => $emojis[$verbs[$verb]]['total'] ?? '',
                                'title'  => $emojis[$verbs[$verb]]['title'] ?? '',
                        ];
@@ -458,7 +458,8 @@ class Post
                        $title = '';
                }
 
-               if (DI::pConfig()->get(DI::userSession()->getLocalUserId(), 'system', 'hide_dislike')) {
+               $hide_dislike = DI::pConfig()->get(DI::userSession()->getLocalUserId(), 'system', 'hide_dislike');
+               if ($hide_dislike) {
                        $buttons['dislike'] = false;
                }
 
@@ -589,13 +590,16 @@ class Post
                        'ignore_author'   => $ignore,
                        'collapse'        => $collapse,
                        'report'          => $report,
-                       'ignore_server'     => $ignoreServer,
+                       'ignore_server'   => $ignoreServer,
                        'vote'            => $buttons,
                        'like_html'       => $responses['like']['output'],
                        'dislike_html'    => $responses['dislike']['output'],
+                       'hide_dislike'    => $hide_dislike,
                        'emojis'          => $emojis,
+                       'quoteshares'     => $this->getQuoteShares($item['quoteshares']),
                        'reactions'       => $reactions,
                        'responses'       => $responses,
+                       'legacy_activities' => DI::config()->get('system', 'legacy_activities'),
                        'switchcomment'   => DI::l10n()->t('Comment'),
                        'reply_label'     => DI::l10n()->t('Reply to %s', $profile_name),
                        'comment_html'    => $comment_html,
@@ -680,68 +684,76 @@ class Post
 
                $emojis = [];
                foreach ($item['emojis'] as $index => $element) {
+                       $key    = $element['verb'];
                        $actors = implode(', ', $element['title']);
                        switch ($element['verb']) {
                                case Activity::ANNOUNCE:
                                        $title = DI::l10n()->t('Reshared by: %s', $actors);
                                        $icon  = ['fa' => 'fa-retweet', 'icon' => 'icon-retweet'];
-                                       $verb  = Activity::ANNOUNCE;
                                        break;
 
                                case Activity::VIEW:
                                        $title = DI::l10n()->t('Viewed by: %s', $actors);
                                        $icon  = ['fa' => 'fa-eye', 'icon' => 'icon-eye-open'];
-                                       $verb  = Activity::VIEW;
                                        break;
 
                                case Activity::LIKE:
                                        $title = DI::l10n()->t('Liked by: %s', $actors);
                                        $icon  = ['fa' => 'fa-thumbs-up', 'icon' => 'icon-thumbs-up'];
-                                       $verb  = Activity::LIKE;
                                        break;
 
                                case Activity::DISLIKE:
                                        $title = DI::l10n()->t('Disliked by: %s', $actors);
                                        $icon  = ['fa' => 'fa-thumbs-down', 'icon' => 'icon-thumbs-down'];
-                                       $verb  = Activity::DISLIKE;
                                        break;
 
                                case Activity::ATTEND:
                                        $title = DI::l10n()->t('Attended by: %s', $actors);
                                        $icon  = ['fa' => 'fa-check', 'icon' => 'icon-ok'];
-                                       $verb  = Activity::ATTEND;
                                        break;
 
                                case Activity::ATTENDMAYBE:
                                        $title = DI::l10n()->t('Maybe attended by: %s', $actors);
                                        $icon  = ['fa' => 'fa-question', 'icon' => 'icon-question'];
-                                       $verb  = Activity::ATTENDMAYBE;
                                        break;
 
                                case Activity::ATTENDNO:
                                        $title = DI::l10n()->t('Not attended by: %s', $actors);
                                        $icon  = ['fa' => 'fa-times', 'icon' => 'icon-remove'];
-                                       $verb  = Activity::ATTENDNO;
                                        break;
 
                                case Activity::POST:
                                        $title = DI::l10n()->t('Commented by: %s', $actors);
-                                       $icon  = ['fa' => 'fa-commenting', 'icon' => 'icon-remove'];
-                                       $verb  = Activity::POST;
+                                       $icon  = ['fa' => 'fa-commenting', 'icon' => 'icon-commenting'];
                                        break;
        
                                default:
                                        $title = DI::l10n()->t('Reacted with %s by: %s', $element['emoji'], $actors);
                                        $icon  = [];
-                                       $verb  = $element['emoji'];
+                                       $key   = $element['emoji'];
                                        break;
                        }
-                       $emojis[$verb] = ['emoji' => $element['emoji'], 'total' => $element['total'], 'title' => $title, 'icon' => $icon];
+                       $emojis[$key] = ['emoji' => $element['emoji'], 'total' => $element['total'], 'title' => $title, 'icon' => $icon];
                }
 
                return $emojis;
        }
 
+       /**
+        * Fetch quote shares
+        *
+        * @param array $quoteshares
+        * @return array
+        */
+       private function getQuoteShares($quoteshares)
+       {
+               if (empty($quoteshares)) {
+                       return [];
+               }
+
+               return ['total' => $quoteshares['total'], 'title' => DI::l10n()->t('Quote shared by: %s', implode(', ', $quoteshares['title']))];
+       }
+
        /**
         * @return integer
         */