From 26a50618b024fe93d85d63e225be001c839067b8 Mon Sep 17 00:00:00 2001 From: Eliseu Amaro Date: Thu, 24 Feb 2022 20:15:55 +0000 Subject: [PATCH] [CARDS][Note] Notification targets are now used as target info, instead of previous reply dependant implementation [COMPONENTS][Group] Feed title is applied to GroupFeed view --- components/Group/Controller/GroupFeed.php | 16 ++++++----- .../Group/templates/group/view.html.twig | 2 +- public/assets/default_theme/widgets.css | 1 + templates/cards/blocks/note.html.twig | 6 ---- templates/cards/macros/note/types.html.twig | 28 +++++++++++++------ 5 files changed, 31 insertions(+), 22 deletions(-) diff --git a/components/Group/Controller/GroupFeed.php b/components/Group/Controller/GroupFeed.php index 4fa9cf58e0..9e6a69ac43 100644 --- a/components/Group/Controller/GroupFeed.php +++ b/components/Group/Controller/GroupFeed.php @@ -26,18 +26,19 @@ namespace Component\Group\Controller; use App\Core\Cache; use App\Core\DB\DB; use App\Core\Form; +use function App\Core\I18n\_m; use App\Core\Router\Router; -use App\Entity as E; use App\Entity\Actor; +use App\Entity as E; use App\Util\Common; use App\Util\Exception\ClientException; use App\Util\Exception\ServerException; +use App\Util\HTML\Heading; use Component\Collection\Util\Controller\FeedController; use Component\Group\Entity\LocalGroup; use Component\Subscription\Entity\ActorSubscription; use Symfony\Component\Form\Extension\Core\Type\SubmitType; use Symfony\Component\HttpFoundation\Request; -use function App\Core\I18n\_m; class GroupFeed extends FeedController { @@ -82,11 +83,12 @@ class GroupFeed extends FeedController EOF, ['id' => $group->getId()]); return [ - '_template' => 'group/view.html.twig', - 'actor' => $group, - 'nickname' => $group->getNickname(), - 'notes' => $notes, - 'subscribe_form' => $subscribe_form?->createView(), + '_template' => 'group/view.html.twig', + 'actor' => $group, + 'nickname' => $group->getNickname(), + 'notes' => $notes, + 'notes_feed_title' => (new Heading(1, [], $group->getNickname() . '\'s feed')), + 'subscribe_form' => $subscribe_form?->createView(), ]; } diff --git a/components/Group/templates/group/view.html.twig b/components/Group/templates/group/view.html.twig index a2e7cf91b3..88a9dc2db8 100644 --- a/components/Group/templates/group/view.html.twig +++ b/components/Group/templates/group/view.html.twig @@ -8,7 +8,7 @@ {% block profile_view %} {% include 'cards/blocks/profile.html.twig' with { 'actor': actor } only %} {% endblock profile_view %} - +
{% if notes is defined %} {{ parent() }} {% endif %} diff --git a/public/assets/default_theme/widgets.css b/public/assets/default_theme/widgets.css index c794d73185..b488ac6954 100644 --- a/public/assets/default_theme/widgets.css +++ b/public/assets/default_theme/widgets.css @@ -7,6 +7,7 @@ -o-mask-image: url(icons/add-actor.svg); -webkit-mask-image: url(icons/add-actor.svg); mask-image: url(icons/add-actor.svg); + opacity: initial !important; } .alert button { diff --git a/templates/cards/blocks/note.html.twig b/templates/cards/blocks/note.html.twig index af5b7f0a2e..e63c5acd8f 100644 --- a/templates/cards/blocks/note.html.twig +++ b/templates/cards/blocks/note.html.twig @@ -30,12 +30,6 @@
{% for conversation in replies %} - {% if extra.depth is defined %} - {% set depth_increment = {'depth': extra.depth + 1} %} - {% set parent = {'parent': block('note_author')} %} - {% set extra = extra|merge(depth_increment) %} - {% set extra = extra|merge(parent) %} - {% endif %} {% set args = { 'type': 'vanilla_full', 'note': conversation['note'], 'replies': conversation['replies'] | default, 'extra': extra } %} {{ NoteFactory.constructor(args) }} diff --git a/templates/cards/macros/note/types.html.twig b/templates/cards/macros/note/types.html.twig index b44eb6d37c..196a46f779 100644 --- a/templates/cards/macros/note/types.html.twig +++ b/templates/cards/macros/note/types.html.twig @@ -25,14 +25,26 @@ {{ block('note_info', 'cards/blocks/note.html.twig') }}
- {% if extra.parent is defined %} - - {{'in reply to' | trans}} {{ extra.parent | raw }} - + {% set notification_targets = note.getNotificationTargets() %} + {% if notification_targets is not empty %} + {% for target in notification_targets %} + {% if target.isGroup() %} + + {{'in ' | trans}} + {{ mention(target) | raw }} + + {% else %} + + {{'in reply to' | trans}} + {{ mention(target) | raw }} + + {% endif %} + {% endfor %} {% endif %} {{ block('note_text', 'cards/blocks/note.html.twig') }} {{ block('note_attachments', 'cards/blocks/note.html.twig') }}