User hide_dislike user setting to hide dislike button and conversation responses

This commit is contained in:
Hypolite Petovan 2020-02-19 22:20:26 -05:00
parent 96ba2ac00d
commit 637e38e535
7 changed files with 34 additions and 12 deletions

View file

@ -587,6 +587,10 @@ function conversation(App $a, array $items, $mode, $update, $preview = false, $o
'announce' => ['title' => DI::l10n()->t('Reshares','title')] '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) // array with html for each thread (parent+comments)
$threads = []; $threads = [];
$threadsid = -1; $threadsid = -1;
@ -678,6 +682,10 @@ function conversation(App $a, array $items, $mode, $update, $preview = false, $o
'share' => null, 'share' => null,
]; ];
if (DI::pConfig()->get(local_user(), 'system', 'hide_dislike')) {
unset($likebuttons['dislike']);
}
$body = Item::prepareBody($item, true, $preview); $body = Item::prepareBody($item, true, $preview);
list($categories, $folders) = DI::contentItem()->determineCategoriesTerms($item); list($categories, $folders) = DI::contentItem()->determineCategoriesTerms($item);

View file

@ -1384,7 +1384,7 @@ function photos_content(App $a)
$likebuttons = Renderer::replaceMacros($like_tpl, [ $likebuttons = Renderer::replaceMacros($like_tpl, [
'$id' => $link_item['id'], '$id' => $link_item['id'],
'$likethis' => DI::l10n()->t("I like this \x28toggle\x29"), '$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'), '$wait' => DI::l10n()->t('Please wait'),
'$return_path' => DI::args()->getQueryString(), '$return_path' => DI::args()->getQueryString(),
]); ]);
@ -1413,10 +1413,17 @@ function photos_content(App $a)
} }
$conv_responses = [ $conv_responses = [
'like' => ['title' => DI::l10n()->t('Likes','title')],'dislike' => ['title' => DI::l10n()->t('Dislikes','title')], 'like' => ['title' => DI::l10n()->t('Likes','title')],
'attendyes' => ['title' => DI::l10n()->t('Attending','title')], 'attendno' => ['title' => DI::l10n()->t('Not attending','title')], 'attendmaybe' => ['title' => DI::l10n()->t('Might attend','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 // display comments
if (DBA::isResult($items)) { if (DBA::isResult($items)) {
foreach ($items as $item) { foreach ($items as $item) {
@ -1515,9 +1522,8 @@ function photos_content(App $a)
} }
} }
} }
$response_verbs = ['like'];
$response_verbs[] = 'dislike'; $responses = get_responses($conv_responses, ['like', 'dislike'], $link_item);
$responses = get_responses($conv_responses, $response_verbs, $link_item);
$paginate = $pager->renderFull($total); $paginate = $pager->renderFull($total);
} }

View file

@ -373,6 +373,10 @@ class Post
$location_e = $location; $location_e = $location;
$owner_name_e = $this->getOwnerName(); $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 // Disable features that aren't available in several networks
if ($buttons["dislike"] && !in_array($item["network"], [Protocol::ACTIVITYPUB, Protocol::DFRN, Protocol::DIASPORA])) { if ($buttons["dislike"] && !in_array($item["network"], [Protocol::ACTIVITYPUB, Protocol::DFRN, Protocol::DIASPORA])) {
$buttons["dislike"] = false; $buttons["dislike"] = false;

View file

@ -1,8 +1,8 @@
<div class="wall-item-like-buttons" id="wall-item-like-buttons-{{$id}}"> <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> <a href="#" class="icon like" title="{{$likethis}}" onclick="dolike({{$id}},'like'); return false"></a>
{{if $nolike}} {{if $dislike}}
<a href="#" class="icon dislike" title="{{$nolike}}" onclick="dolike({{$id}},'dislike'); return false"></a> <a href="#" class="icon dislike" title="{{$dislike}}" onclick="dolike({{$id}},'dislike'); return false"></a>
{{/if}} {{/if}}
<img id="like-rotator-{{$id}}" class="like-rotator" src="images/rotator.gif" alt="{{$wait}}" title="{{$wait}}" style="display: none;" /> <img id="like-rotator-{{$id}}" class="like-rotator" src="images/rotator.gif" alt="{{$wait}}" title="{{$wait}}" style="display: none;" />
</div> </div>

View 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"> <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> <i class="faded-icon page-action fa fa-thumbs-up" aria-hidden="true"></i>
</button> </button>
{{if $nolike}} {{if $dislike}}
<span class="icon-padding"> </span> <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> <i class="faded-icon page-action fa fa-thumbs-down" aria-hidden="true"></i>
</button> </button>
{{/if}} {{/if}}

View file

@ -53,8 +53,10 @@
<a href="#" id="tagger-{{$item.id}}" onclick="itemTag({{$item.id}}); return false;" class="{{$item.star.classtagger}}" title="{{$item.star.tagger}}">{{$item.star.tagger}}</a> <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}}
{{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> <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> <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}} {{/if}}

View file

@ -60,8 +60,10 @@
<a href="#" id="tagger-{{$item.id}}" onclick="itemTag({{$item.id}}); return false;" class="{{$item.star.classtagger}}" title="{{$item.star.tagger}}">{{$item.star.tagger}}</a> <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}}
{{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> <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> <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}} {{/if}}