]> git.mxchange.org Git - friendica.git/commitdiff
User hide_dislike user setting to hide dislike button and conversation responses
authorHypolite Petovan <hypolite@mrpetovan.com>
Thu, 20 Feb 2020 03:20:26 +0000 (22:20 -0500)
committerHypolite Petovan <hypolite@mrpetovan.com>
Thu, 20 Feb 2020 10:37:07 +0000 (05:37 -0500)
include/conversation.php
mod/photos.php
src/Object/Post.php
view/templates/like_noshare.tpl
view/theme/frio/templates/like_noshare.tpl
view/theme/quattro/templates/search_item.tpl
view/theme/vier/templates/search_item.tpl

index e713994bc6f6b1d8eab5042357bf8932a5c906ec..f29e6d32540f2da89f55f7e9e459173ce91c0717 100644 (file)
@@ -587,6 +587,10 @@ function conversation(App $a, array $items, $mode, $update, $preview = false, $o
                'announce' => ['title' => DI::l10n()->t('Reshares','title')]
        ];
 
+       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);
index 03b78e0e19f6b6cb2316832efe85b91ad424c7da..9511261553f0d5f46f1f81649635b734f8579506 100644 (file)
@@ -1384,7 +1384,7 @@ function photos_content(App $a)
                                $likebuttons = Renderer::replaceMacros($like_tpl, [
                                        '$id' => $link_item['id'],
                                        '$likethis' => DI::l10n()->t("I like this \x28toggle\x29"),
-                                       '$nolike' => DI::l10n()->t("I don't like this \x28toggle\x29"),
+                                       '$dislike' => DI::pConfig()->get(local_user(), 'system', 'hide_dislike') ? '' : DI::l10n()->t("I don't like this \x28toggle\x29"),
                                        '$wait' => DI::l10n()->t('Please wait'),
                                        '$return_path' => DI::args()->getQueryString(),
                                ]);
@@ -1413,10 +1413,17 @@ function photos_content(App $a)
                        }
 
                        $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')]
+                               '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')]
                        ];
 
+                       if (DI::pConfig()->get(local_user(), 'system', 'hide_dislike')) {
+                               unset($conv_responses['dislike']);
+                       }
+
                        // display comments
                        if (DBA::isResult($items)) {
                                foreach ($items as $item) {
@@ -1515,9 +1522,8 @@ function photos_content(App $a)
                                        }
                                }
                        }
-                       $response_verbs = ['like'];
-                       $response_verbs[] = 'dislike';
-                       $responses = get_responses($conv_responses, $response_verbs, $link_item);
+
+                       $responses = get_responses($conv_responses, ['like', 'dislike'], $link_item);
 
                        $paginate = $pager->renderFull($total);
                }
index 5f264c988bab5124c8e3fadd097dac28046aaf5d..c92c5a32bb123aa55373e146f6eb42384330e41d 100644 (file)
@@ -373,6 +373,10 @@ class Post
                $location_e   = $location;
                $owner_name_e = $this->getOwnerName();
 
+               if (DI::pConfig()->get(local_user(), 'system', 'hide_dislike')) {
+                       $buttons['dislike'] = false;
+               }
+
                // 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;
index 25e1e0914792a1e57f355090f3f61aa1810f1de0..3df365e7275705cdbb1da907e0a5ccf32fb78568 100644 (file)
@@ -1,8 +1,8 @@
 
 <div class="wall-item-like-buttons" id="wall-item-like-buttons-{{$id}}">
        <a href="#" class="icon like" title="{{$likethis}}" onclick="dolike({{$id}},'like'); return false"></a>
-       {{if $nolike}}
-       <a href="#" class="icon dislike" title="{{$nolike}}" onclick="dolike({{$id}},'dislike'); return false"></a>
+       {{if $dislike}}
+       <a href="#" class="icon dislike" title="{{$dislike}}" onclick="dolike({{$id}},'dislike'); return false"></a>
        {{/if}}
        <img id="like-rotator-{{$id}}" class="like-rotator" src="images/rotator.gif" alt="{{$wait}}" title="{{$wait}}" style="display: none;" />
 </div>
index deb2383f4badd624d9d06ef52caa6050fa04339e..b2a56292c72c9be94c8ed97e84d1a996017583a0 100644 (file)
@@ -3,9 +3,9 @@
        <button type="button" class="btn-link button-likes" id="like-{{$id}}" title="{{$likethis}}" onclick="dolike({{$id}},'like'); return false;" data-toggle="button">
                <i class="faded-icon page-action fa fa-thumbs-up" aria-hidden="true"></i>
        </button>
-       {{if $nolike}}
+       {{if $dislike}}
        <span class="icon-padding"> </span>
-       <button type="button" class="btn-link button-likes" id="dislike-{{$id}}" title="{{$nolike}}" onclick="dolike({{$id}},'dislike'); return false;" data-toggle="button">
+       <button type="button" class="btn-link button-likes" id="dislike-{{$id}}" title="{{$dislike}}" onclick="dolike({{$id}},'dislike'); return false;" data-toggle="button">
                <i class="faded-icon page-action fa fa-thumbs-down" aria-hidden="true"></i>
        </button>
        {{/if}}
index 75d5ef566f9ca6955df2f58acb910c47afc3e5d0..38ac6cf63de4d8a5702b7fa6fafbe95052d22215 100644 (file)
                                <a href="#" id="tagger-{{$item.id}}" onclick="itemTag({{$item.id}}); return false;" class="{{$item.star.classtagger}}" title="{{$item.star.tagger}}">{{$item.star.tagger}}</a>
                        {{/if}}
 
-                       {{if $item.vote}}
+                       {{if $item.vote.like}}
                                <a href="#" id="like-{{$item.id}}"{{if $item.responses.like.self}} class="active{{/if}}" title="{{$item.vote.like.0}}" onclick="dolike({{$item.id}},'like'); return false">{{$item.vote.like.1}}</a>
+                       {{/if}}
+                       {{if $item.vote.dislike}}
                                <a href="#" id="dislike-{{$item.id}}"{{if $item.responses.dislike.self}} class="active{{/if}}" title="{{$item.vote.dislike.0}}" onclick="dolike({{$item.id}},'dislike'); return false">{{$item.vote.dislike.1}}</a>
                        {{/if}}
 
index bce28962ec436446fea820d90ce6ad488566627d..c1bbaf7cf1936189379f3ab60c03de57a3a1b234 100644 (file)
                                <a href="#" id="tagger-{{$item.id}}" onclick="itemTag({{$item.id}}); return false;" class="{{$item.star.classtagger}}" title="{{$item.star.tagger}}">{{$item.star.tagger}}</a>
                        {{/if}}
 
-                       {{if $item.vote}}
+                       {{if $item.vote.like}}
                                <a href="#" id="like-{{$item.id}}"{{if $item.responses.like.self}} class="active"{{/if}} title="{{$item.vote.like.0}}" onclick="dolike({{$item.id}},'like'); return false">{{$item.vote.like.1}}</a>
+                       {{/if}}
+                       {{if $item.vote.dislike}}
                                <a href="#" id="dislike-{{$item.id}}"{{if $item.responses.dislike.self}} class="active"{{/if}} title="{{$item.vote.dislike.0}}" onclick="dolike({{$item.id}},'dislike'); return false">{{$item.vote.dislike.1}}</a>
                        {{/if}}