[EVENTS] Change FormatNoteList do separate in and out arguments

This is necessary due to some weird problem which I wasn't able to figure out (but which doesn't matter)
that somehow causes the event to be called twice during testing, and thus the function was exploding
This commit is contained in:
2021-08-07 21:52:00 +00:00
parent 57f43108bb
commit 061a85d6b3
4 changed files with 58 additions and 15 deletions

View File

@@ -56,11 +56,11 @@ class Network extends Controller
{
$notes = Note::getAllNotes($this->instance_scope);
Event::handle('FormatNoteList', [&$notes]);
Event::handle('FormatNoteList', [$notes, &$notes_out]);
return [
'_template' => 'network/public.html.twig',
'notes' => $notes,
'notes' => $notes_out,
];
}
@@ -98,11 +98,11 @@ class Network extends Controller
END;
$notes = DB::sql($query, ['note' => 'App\Entity\Note'], ['target_actor_id' => $target->getId()]);
Event::handle('FormatNoteList', [&$notes]);
Event::handle('FormatNoteList', [$notes, &$notes_out]);
return [
'_template' => 'network/public.html.twig',
'notes' => $notes,
'notes' => $notes_out,
];
}
@@ -110,11 +110,11 @@ END;
{
$notes = Note::getAllNotes($this->public_scope);
Event::handle('FormatNoteList', [&$notes]);
Event::handle('FormatNoteList', [$notes, &$notes_out]);
return [
'_template' => 'network/public.html.twig',
'notes' => $notes,
'notes' => $notes_out,
];
}
@@ -125,11 +125,11 @@ END;
'where n.reply_to is not null and n.gsactor_id = :id ' .
'order by n.created DESC', ['id' => $actor_id]);
Event::handle('FormatNoteList', [&$notes]);
Event::handle('FormatNoteList', [$notes, &$notes_out]);
return [
'_template' => 'network/public.html.twig',
'notes' => $notes,
'notes' => $notes_out,
];
}
}