[PLUGINS][Reply] Fix return on getReplyToNote

The array contained an object, the result was within that object and not the object itself.
This commit is contained in:
2021-11-29 14:50:25 +00:00
committed by Diogo Peralta Cordeiro
parent db33800ade
commit 01078e20fb
2 changed files with 4 additions and 4 deletions

View File

@@ -32,7 +32,7 @@ class TreeNotes extends Plugin
*/
public function onFormatNoteList(array $notes_in, ?array &$notes_out)
{
$roots = array_filter($notes_in, fn (Note $note) => NoteReply::getReplyToNote($note) == null);
$roots = array_filter($notes_in, fn (Note $note) => \is_null(NoteReply::getReplyToNote($note)));
$notes_out = $this->build_tree($roots, $notes_in);
}
@@ -47,7 +47,7 @@ class TreeNotes extends Plugin
private function build_subtree(Note $parent, array $notes)
{
$children = array_filter($notes, fn (Note $note) => $parent->getId() == NoteReply::getReplyToNote($note));
$children = array_filter($notes, fn (Note $note) => $parent->getId() === NoteReply::getReplyToNote($note));
return ['note' => $parent, 'replies' => $this->build_tree($children, $notes)];
}
}