[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

This commit is contained in:
Eliseu Amaro 2022-02-24 20:15:55 +00:00 committed by Diogo Peralta Cordeiro
parent d5731e6351
commit 26a50618b0
No known key found for this signature in database
GPG Key ID: 18D2D35001FBFAB0
5 changed files with 31 additions and 22 deletions

View File

@ -26,18 +26,19 @@ namespace Component\Group\Controller;
use App\Core\Cache; use App\Core\Cache;
use App\Core\DB\DB; use App\Core\DB\DB;
use App\Core\Form; use App\Core\Form;
use function App\Core\I18n\_m;
use App\Core\Router\Router; use App\Core\Router\Router;
use App\Entity as E;
use App\Entity\Actor; use App\Entity\Actor;
use App\Entity as E;
use App\Util\Common; use App\Util\Common;
use App\Util\Exception\ClientException; use App\Util\Exception\ClientException;
use App\Util\Exception\ServerException; use App\Util\Exception\ServerException;
use App\Util\HTML\Heading;
use Component\Collection\Util\Controller\FeedController; use Component\Collection\Util\Controller\FeedController;
use Component\Group\Entity\LocalGroup; use Component\Group\Entity\LocalGroup;
use Component\Subscription\Entity\ActorSubscription; use Component\Subscription\Entity\ActorSubscription;
use Symfony\Component\Form\Extension\Core\Type\SubmitType; use Symfony\Component\Form\Extension\Core\Type\SubmitType;
use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Request;
use function App\Core\I18n\_m;
class GroupFeed extends FeedController class GroupFeed extends FeedController
{ {
@ -82,11 +83,12 @@ class GroupFeed extends FeedController
EOF, ['id' => $group->getId()]); EOF, ['id' => $group->getId()]);
return [ return [
'_template' => 'group/view.html.twig', '_template' => 'group/view.html.twig',
'actor' => $group, 'actor' => $group,
'nickname' => $group->getNickname(), 'nickname' => $group->getNickname(),
'notes' => $notes, 'notes' => $notes,
'subscribe_form' => $subscribe_form?->createView(), 'notes_feed_title' => (new Heading(1, [], $group->getNickname() . '\'s feed')),
'subscribe_form' => $subscribe_form?->createView(),
]; ];
} }

View File

@ -8,7 +8,7 @@
{% block profile_view %} {% block profile_view %}
{% include 'cards/blocks/profile.html.twig' with { 'actor': actor } only %} {% include 'cards/blocks/profile.html.twig' with { 'actor': actor } only %}
{% endblock profile_view %} {% endblock profile_view %}
<hr>
{% if notes is defined %} {% if notes is defined %}
{{ parent() }} {{ parent() }}
{% endif %} {% endif %}

View File

@ -7,6 +7,7 @@
-o-mask-image: url(icons/add-actor.svg); -o-mask-image: url(icons/add-actor.svg);
-webkit-mask-image: url(icons/add-actor.svg); -webkit-mask-image: url(icons/add-actor.svg);
mask-image: url(icons/add-actor.svg); mask-image: url(icons/add-actor.svg);
opacity: initial !important;
} }
.alert button { .alert button {

View File

@ -30,12 +30,6 @@
<div class="note-replies-start"></div> <div class="note-replies-start"></div>
<div class="u-in-reply-to replies"> <div class="u-in-reply-to replies">
{% for conversation in replies %} {% 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 %}
<span class="note-replies-indicator" role="presentation"></span> <span class="note-replies-indicator" role="presentation"></span>
{% set args = { 'type': 'vanilla_full', 'note': conversation['note'], 'replies': conversation['replies'] | default, 'extra': extra } %} {% set args = { 'type': 'vanilla_full', 'note': conversation['note'], 'replies': conversation['replies'] | default, 'extra': extra } %}
{{ NoteFactory.constructor(args) }} {{ NoteFactory.constructor(args) }}

View File

@ -25,14 +25,26 @@
{{ block('note_info', 'cards/blocks/note.html.twig') }} {{ block('note_info', 'cards/blocks/note.html.twig') }}
<section class="e-content entry-content note-content" title="{{ 'Note\'s main content' | trans }}"> <section class="e-content entry-content note-content" title="{{ 'Note\'s main content' | trans }}">
{% if extra.parent is defined %} {% set notification_targets = note.getNotificationTargets() %}
<em {% if notification_targets is not empty %}
tabindex="0" {% for target in notification_targets %}
class="note-replies-parent" {% if target.isGroup() %}
title="{{'This is a reply with depth: ' | trans}} {{ extra.depth }}" <em tabindex="0"
aria-flowto="note-anchor-"> class="note-replies-parent"
{{'in reply to' | trans}} {{ extra.parent | raw }} title="{{'The group in which this note was addressed to' | trans}}">
</em> {{'in ' | trans}}
<a href="{{ target.getUrl() }}">{{ mention(target) | raw }}</a>
</em>
{% else %}
<em tabindex="0"
class="note-replies-parent"
title="{{'Whom this is a reply to' | trans}}"
aria-flowto="note-anchor-{{ note.getReplyTo() }}">
{{'in reply to' | trans}}
<a href="{{ target.getUrl() }}">{{ mention(target) | raw }}</a>
</em>
{% endif %}
{% endfor %}
{% endif %} {% endif %}
{{ block('note_text', 'cards/blocks/note.html.twig') }} {{ block('note_text', 'cards/blocks/note.html.twig') }}
{{ block('note_attachments', 'cards/blocks/note.html.twig') }} {{ block('note_attachments', 'cards/blocks/note.html.twig') }}