[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:
parent
db33800ade
commit
01078e20fb
@ -95,8 +95,8 @@ class NoteReply extends Entity
|
|||||||
$result = DB::dql('select nr.reply_to from note_reply nr '
|
$result = DB::dql('select nr.reply_to from note_reply nr '
|
||||||
. 'where nr.note_id = :note_id', ['note_id' => $note->getId()], );
|
. 'where nr.note_id = :note_id', ['note_id' => $note->getId()], );
|
||||||
|
|
||||||
if (!\is_null($result) && \array_key_exists('reply_to', $result)) {
|
if (!\is_null($result) && \array_key_exists(0, $result)) {
|
||||||
return $result['reply_to'];
|
return $result[0]['reply_to'];
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
|
@ -32,7 +32,7 @@ class TreeNotes extends Plugin
|
|||||||
*/
|
*/
|
||||||
public function onFormatNoteList(array $notes_in, ?array &$notes_out)
|
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);
|
$notes_out = $this->build_tree($roots, $notes_in);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -47,7 +47,7 @@ class TreeNotes extends Plugin
|
|||||||
|
|
||||||
private function build_subtree(Note $parent, array $notes)
|
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)];
|
return ['note' => $parent, 'replies' => $this->build_tree($children, $notes)];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user