[PLUGIN][Reply] Separated replies from Note table.

[PLUGIN][Repeat] Deleted unnecessary card note template, info now to
appended at the end of note.
[PLUGIN][TreeNotes] WIP to accomodate reply plugin changes.
[TWIG][Runtime] Removed getAdditionalTemplateVars event.
This commit is contained in:
2021-11-07 01:32:06 +00:00
parent 7d8819a3da
commit f2f1bdc145
14 changed files with 291 additions and 232 deletions

View File

@@ -23,6 +23,7 @@ namespace Plugin\TreeNotes;
use App\Core\Modules\Plugin;
use App\Entity\Note;
use Plugin\Reply\Entity\NoteReply;
class TreeNotes extends Plugin
{
@@ -31,7 +32,7 @@ class TreeNotes extends Plugin
*/
public function onFormatNoteList(array $notes_in, ?array &$notes_out)
{
$roots = array_filter($notes_in, fn (Note $note) => $note->getReplyTo() == null);
$roots = array_filter($notes_in, fn (Note $note) => NoteReply::getReplyToNote($note) == null);
$notes_out = $this->build_tree($roots, $notes_in);
}
@@ -46,7 +47,7 @@ class TreeNotes extends Plugin
private function build_subtree(Note $parent, array $notes)
{
$children = array_filter($notes, fn (Note $n) => $parent->getId() == $n->getReplyTo());
$children = array_filter($notes, fn (Note $note) => $parent->getId() == NoteReply::getReplyToNote($note));
return ['note' => $parent, 'replies' => $this->build_tree($children, $notes)];
}
}