From 14bb1b2876c27409ce5d856fb20ca335324ff8cb Mon Sep 17 00:00:00 2001 From: Eliseu Amaro Date: Tue, 25 Jan 2022 19:17:40 +0000 Subject: [PATCH] [COMPONENTS][Conversation] Note being replied to now appears before Posting's own form, RightPanel is also open by default on smaller screens when the current route is 'conversation_reply_to' --- components/Conversation/Conversation.php | 13 +++++++++++++ .../templates/right_panel/view.html.twig | 16 ++++++++++++---- public/assets/default_theme/css/pages/feeds.css | 2 +- .../note/macro_note_minimal_wrapper.html.twig | 2 ++ 4 files changed, 28 insertions(+), 5 deletions(-) create mode 100644 templates/cards/note/macro_note_minimal_wrapper.html.twig diff --git a/components/Conversation/Conversation.php b/components/Conversation/Conversation.php index c56c3f6e76..ad5bf5a31d 100644 --- a/components/Conversation/Conversation.php +++ b/components/Conversation/Conversation.php @@ -34,6 +34,8 @@ use App\Entity\Activity; use App\Entity\Actor; use App\Entity\Note; use App\Util\Common; +use App\Util\Exception\RedirectException; +use App\Util\Formatting; use Component\Conversation\Entity\Conversation as ConversationEntity; use Component\Conversation\Entity\ConversationMute; use Functional as F; @@ -194,6 +196,17 @@ class Conversation extends Component return Event::next; } + /** + * Add minimal Note card to RightPanel template + * + * @throws RedirectException + */ + public function onPrependPostingForm(Request $request, array &$elements) + { + $elements[] = Formatting::twigRenderFile('cards/note/macro_note_minimal_wrapper.html.twig', ['note' => Note::getById((int) $request->query->get('reply_to_id'))]); + return Event::next; + } + /** * Event launched when deleting given Note, it's deletion implies further changes to object related to this Note. * Please note, **replies are NOT deleted**, their reply_to is only set to null since this Note no longer exists. diff --git a/components/RightPanel/templates/right_panel/view.html.twig b/components/RightPanel/templates/right_panel/view.html.twig index 2fc95259f0..f67f221cd4 100644 --- a/components/RightPanel/templates/right_panel/view.html.twig +++ b/components/RightPanel/templates/right_panel/view.html.twig @@ -1,7 +1,8 @@ {% block rightpanel %} +{% set current_path = app.request.get('_route') %} - +