[COMPONENT][Feed][Conversation] Add note-conversation:

This commit is contained in:
Diogo Peralta Cordeiro 2021-12-23 16:18:46 +00:00
parent 17b7ef13a0
commit e04d927fe9
Signed by: diogo
GPG Key ID: 18D2D35001FBFAB0
2 changed files with 11 additions and 4 deletions

View File

@ -26,8 +26,8 @@ declare(strict_types = 1);
namespace Component\Conversation\Controller; namespace Component\Conversation\Controller;
use App\Core\DB\DB;
use function App\Core\I18n\_m; use function App\Core\I18n\_m;
use Component\Feed\Feed;
use Component\Feed\Util\FeedController; use Component\Feed\Util\FeedController;
use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Request;
@ -44,9 +44,13 @@ class Conversation extends FeedController
// if note is root -> just link // if note is root -> just link
// if note is a reply -> link from above plus anchor // if note is a reply -> link from above plus anchor
$notes = DB::dql('select n from App\Entity\Note n ' /* $notes = DB::findBy(
. 'on n.conversation_id = :id ' table: 'note',
. 'order by n.created DESC', ['id' => $conversation_id], ); 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 [ return [
'_template' => 'feed/feed.html.twig', '_template' => 'feed/feed.html.twig',
'notes' => $notes, 'notes' => $notes,

View File

@ -87,6 +87,9 @@ class Feed extends Component
$note_expr[] = $eb->eq('note.content', null); $note_expr[] = $eb->eq('note.content', null);
} }
break; break;
case 'note-conversation':
$note_expr = $eb->eq('note.conversation_id', (int)trim($term[1]));
break;
} }
} elseif (Formatting::startsWith($term, 'actor-')) { } elseif (Formatting::startsWith($term, 'actor-')) {
switch ($term[0]) { switch ($term[0]) {