From 4370d0b96751a9b91521dfa75f580a920cda592a Mon Sep 17 00:00:00 2001 From: Hypolite Petovan Date: Sat, 21 Nov 2020 11:10:04 -0500 Subject: [PATCH] Add missing activity toggle capability to photos --- mod/photos.php | 33 ++++++++++++++-------- view/templates/like_noshare.tpl | 4 +-- view/theme/frio/templates/like_noshare.tpl | 20 +++++++++---- 3 files changed, 38 insertions(+), 19 deletions(-) diff --git a/mod/photos.php b/mod/photos.php index fd831d5e2e..1a16f68026 100644 --- a/mod/photos.php +++ b/mod/photos.php @@ -1361,17 +1361,6 @@ function photos_content(App $a) $tpl = Renderer::getMarkupTemplate('photo_item.tpl'); $return_path = DI::args()->getCommand(); - if ($cmd === 'view' && ($can_post || Security::canWriteToUserWall($owner_uid))) { - $like_tpl = Renderer::getMarkupTemplate('like_noshare.tpl'); - $likebuttons = Renderer::replaceMacros($like_tpl, [ - '$id' => $link_item['id'], - '$likethis' => DI::l10n()->t("I 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(), - ]); - } - if (!DBA::isResult($items)) { if (($can_post || Security::canWriteToUserWall($owner_uid))) { /* @@ -1534,6 +1523,28 @@ function photos_content(App $a) } } + $responses = []; + foreach ($conv_responses as $verb => $activity) { + if (isset($activity[$link_item['uri']])) { + $responses[$verb] = $activity[$link_item['uri']]; + } + } + + if ($cmd === 'view' && ($can_post || Security::canWriteToUserWall($owner_uid))) { + $like_tpl = Renderer::getMarkupTemplate('like_noshare.tpl'); + $likebuttons = Renderer::replaceMacros($like_tpl, [ + '$id' => $link_item['id'], + '$like' => DI::l10n()->t('Like'), + '$like_title' => DI::l10n()->t('I like this (toggle)'), + '$dislike' => DI::l10n()->t('Dislike'), + '$wait' => DI::l10n()->t('Please wait'), + '$dislike_title' => DI::l10n()->t('I don\'t like this (toggle)'), + '$hide_dislike' => DI::pConfig()->get(local_user(), 'system', 'hide_dislike'), + '$responses' => $responses, + '$return_path' => DI::args()->getQueryString(), + ]); + } + $paginate = $pager->renderFull($total); } diff --git a/view/templates/like_noshare.tpl b/view/templates/like_noshare.tpl index 3df365e727..4419a5b97a 100644 --- a/view/templates/like_noshare.tpl +++ b/view/templates/like_noshare.tpl @@ -1,8 +1,8 @@
- + {{if $dislike}} - + {{/if}}
diff --git a/view/theme/frio/templates/like_noshare.tpl b/view/theme/frio/templates/like_noshare.tpl index b2a56292c7..dd3fa2e5f6 100644 --- a/view/theme/frio/templates/like_noshare.tpl +++ b/view/theme/frio/templates/like_noshare.tpl @@ -1,12 +1,20 @@
- - {{if $dislike}} - - {{/if}}