[COMPONENTS][Conversation] reply_add route nows shows the given Note entire conversation, the Note itself is highlighted in the conversation

This commit is contained in:
Eliseu Amaro 2021-12-30 18:34:07 +00:00
parent 34cc010136
commit 6dd31926ad
No known key found for this signature in database
GPG Key ID: 96DA09D4B97BC2D5
5 changed files with 18 additions and 17 deletions

View File

@ -26,10 +26,10 @@ declare(strict_types = 1);
namespace Component\Conversation\Controller;
use function App\Core\I18n\_m;
use Component\Feed\Feed;
use Component\Feed\Util\FeedController;
use Symfony\Component\HttpFoundation\Request;
use function App\Core\I18n\_m;
class Conversation extends FeedController
{
@ -40,15 +40,6 @@ class Conversation extends FeedController
*/
public function showConversation(Request $request, int $conversation_id)
{
// TODO:
// if note is root -> just link
// if note is a reply -> link from above plus anchor
/* $notes = DB::findBy(
table: 'note',
criteria: ['conversation_id' => $conversation_id],
order_by: ['created' => 'DESC', 'id' => 'DESC']
);*/
$data = Feed::query(query: "note-conversation:{$conversation_id}", page: $this->int('p') ?? 1);
$notes = $data['notes'];
return [

View File

@ -32,8 +32,10 @@ use App\Util\Exception\ClientException;
use App\Util\Exception\NoLoggedInUser;
use App\Util\Exception\NoSuchNoteException;
use App\Util\Exception\ServerException;
use Component\Feed\Feed;
use Component\Feed\Util\FeedController;
use Symfony\Component\HttpFoundation\Request;
use function App\Core\I18n\_m;
class Reply extends FeedController
{
@ -56,9 +58,14 @@ class Reply extends FeedController
throw new NoSuchNoteException();
}
$conversation_id = $note->getConversationId();
$data = Feed::query(query: "note-conversation:{$conversation_id}", page: $this->int('p') ?? 1);
$notes = $data['notes'];
return [
'_template' => 'reply/add_reply.html.twig',
'note' => $note,
'_template' => 'feed/feed.html.twig',
'notes' => $notes,
'should_format' => false,
'page_title' => _m('Conversation'),
];
}
}

View File

@ -26,17 +26,16 @@ namespace Component\Conversation;
use App\Core\Cache;
use App\Core\DB\DB;
use App\Core\Event;
use function App\Core\I18n\_m;
use App\Core\Modules\Component;
use App\Core\Router\RouteLoader;
use App\Core\Router\Router;
use App\Entity\Actor;
use App\Entity\Note;
use App\Util\Common;
use App\Util\Formatting;
use Component\Conversation\Controller\Reply as ReplyController;
use Component\Conversation\Entity\Conversation as ConversationEntity;
use Symfony\Component\HttpFoundation\Request;
use function App\Core\I18n\_m;
class Conversation extends Component
{
@ -92,7 +91,7 @@ class Conversation extends Component
$query_string = $request->getQueryString();
// Concatenating get parameter to redirect the user to where he came from
$reply_action_url .= '?from=' . urlencode($request->getRequestUri());
$reply_action_url .= '?from=' . urlencode($request->getRequestUri()) . '#note-anchor-' . $note->getId();
$reply_action = [
'url' => $reply_action_url,

View File

@ -14,6 +14,9 @@
.notes hr {
margin-top: var(--s);
}
article[id^="note-anchor-"]:target {
border: 2px solid var(--accent) !important;
}
.note-wrapper {
width: 100%;
height: inherit;
@ -106,7 +109,7 @@
embed header {
display: flex;
border-bottom: unset;
border-radius: var(--s) var(--s) 0 0;
border-radius: 0 var(--s) 0 0;
line-height: initial;
padding: 8px var(--s) 8px 0;
}

View File

@ -159,7 +159,8 @@
{% set mention = mention(actor) %}
{% set note_language = note.getNoteLanguageShortDisplay() %}
<article class="h-entry hentry note" lang={{ note.getLanguageLocale() }}>
<article id="{{ 'note-anchor-' ~ note.getId() }}"
class="h-entry hentry note" lang={{ note.getLanguageLocale() }}>
{{ block('note_sidebar') }}
<div class="note-wrapper">
{{ block('note_info') }}