]> git.mxchange.org Git - friendica.git/blobdiff - include/conversation.php
Merge remote-tracking branch 'upstream/develop' into private
[friendica.git] / include / conversation.php
index e713994bc6f6b1d8eab5042357bf8932a5c906ec..8c09fa98b34379aebee0facb95623db1bd4e36cd 100644 (file)
@@ -579,14 +579,18 @@ function conversation(App $a, array $items, $mode, $update, $preview = false, $o
        $items = $cb['items'];
 
        $conv_responses = [
-               'like' => ['title' => DI::l10n()->t('Likes','title')],
-               'dislike' => ['title' => DI::l10n()->t('Dislikes','title')],
-               'attendyes' => ['title' => DI::l10n()->t('Attending','title')],
-               'attendno' => ['title' => DI::l10n()->t('Not attending','title')],
-               'attendmaybe' => ['title' => DI::l10n()->t('Might attend','title')],
-               'announce' => ['title' => DI::l10n()->t('Reshares','title')]
+               'like'        => [],
+               'dislike'     => [],
+               'attendyes'   => [],
+               'attendno'    => [],
+               'attendmaybe' => [],
+               'announce'    => [],    
        ];
 
+       if (DI::pConfig()->get(local_user(), 'system', 'hide_dislike')) {
+               unset($conv_responses['dislike']);
+       }
+
        // array with html for each thread (parent+comments)
        $threads = [];
        $threadsid = -1;
@@ -678,6 +682,10 @@ function conversation(App $a, array $items, $mode, $update, $preview = false, $o
                                        'share'   => null,
                                ];
 
+                               if (DI::pConfig()->get(local_user(), 'system', 'hide_dislike')) {
+                                       unset($likebuttons['dislike']);
+                               }
+
                                $body = Item::prepareBody($item, true, $preview);
 
                                list($categories, $folders) = DI::contentItem()->determineCategoriesTerms($item);
@@ -1564,56 +1572,3 @@ function render_location_dummy(array $item) {
                return $item['coord'];
        }
 }
-
-function get_responses(array $conv_responses, array $response_verbs, array $item, Post $ob = null) {
-       $ret = [];
-       foreach ($response_verbs as $v) {
-               $ret[$v] = [];
-               $ret[$v]['count'] = $conv_responses[$v][$item['uri']] ?? 0;
-               $ret[$v]['list']  = $conv_responses[$v][$item['uri'] . '-l'] ?? [];
-               $ret[$v]['self']  = $conv_responses[$v][$item['uri'] . '-self'] ?? '0';
-               if (count($ret[$v]['list']) > MAX_LIKERS) {
-                       $ret[$v]['list_part'] = array_slice($ret[$v]['list'], 0, MAX_LIKERS);
-                       array_push($ret[$v]['list_part'], '<a href="#" data-toggle="modal" data-target="#' . $v . 'Modal-'
-                               . (($ob) ? $ob->getId() : $item['id']) . '"><b>' . DI::l10n()->t('View all') . '</b></a>');
-               } else {
-                       $ret[$v]['list_part'] = '';
-               }
-               $ret[$v]['button'] = get_response_button_text($v, $ret[$v]['count']);
-               $ret[$v]['title'] = $conv_responses[$v]['title'];
-       }
-
-       $count = 0;
-       foreach ($ret as $key) {
-               if ($key['count'] == true) {
-                       $count++;
-               }
-       }
-       $ret['count'] = $count;
-
-       return $ret;
-}
-
-function get_response_button_text($v, $count)
-{
-       $return = '';
-       switch ($v) {
-               case 'like':
-                       $return = DI::l10n()->tt('Like', 'Likes', $count);
-                       break;
-               case 'dislike':
-                       $return = DI::l10n()->tt('Dislike', 'Dislikes', $count);
-                       break;
-               case 'attendyes':
-                       $return = DI::l10n()->tt('Attending', 'Attending', $count);
-                       break;
-               case 'attendno':
-                       $return = DI::l10n()->tt('Not Attending', 'Not Attending', $count);
-                       break;
-               case 'attendmaybe':
-                       $return = DI::l10n()->tt('Undecided', 'Undecided', $count);
-                       break;
-       }
-
-       return $return;
-}