forked from GNUsocial/gnu-social
[EVENT][FilterNoteList] Use an in-out parameter, so multiple events can act on this
This commit is contained in:
parent
3405312a5b
commit
1be4b3d481
@ -76,7 +76,7 @@ class TagBasedFiltering extends Plugin
|
|||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
public function onFilterNoteList(Actor $actor, array $notes, ?array &$notes_out)
|
public function onFilterNoteList(Actor $actor, array &$notes)
|
||||||
{
|
{
|
||||||
$blocked_note_tags = Cache::get(
|
$blocked_note_tags = Cache::get(
|
||||||
self::cacheKeys($actor)['note'],
|
self::cacheKeys($actor)['note'],
|
||||||
@ -87,7 +87,7 @@ class TagBasedFiltering extends Plugin
|
|||||||
fn () => DB::dql('select atb from actor_tag_block atb where atb.blocker = :blocker', ['blocker' => $actor->getId()]),
|
fn () => DB::dql('select atb from actor_tag_block atb where atb.blocker = :blocker', ['blocker' => $actor->getId()]),
|
||||||
);
|
);
|
||||||
|
|
||||||
$notes_out = F\reject(
|
$notes = F\reject(
|
||||||
$notes,
|
$notes,
|
||||||
fn (Note $n) => (
|
fn (Note $n) => (
|
||||||
$n->getActor()->getId() != $actor->getId()
|
$n->getActor()->getId() != $actor->getId()
|
||||||
|
@ -45,9 +45,7 @@ abstract class FeedController extends Controller
|
|||||||
if (\array_key_exists('notes', $result)) {
|
if (\array_key_exists('notes', $result)) {
|
||||||
$notes = $result['notes'];
|
$notes = $result['notes'];
|
||||||
if (!\is_null($actor)) {
|
if (!\is_null($actor)) {
|
||||||
$notes_out = null;
|
Event::handle('FilterNoteList', [$actor, &$notes]);
|
||||||
Event::handle('FilterNoteList', [$actor, $notes, &$notes_out]);
|
|
||||||
$notes = $notes_out;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$notes_out = null;
|
$notes_out = null;
|
||||||
|
Loading…
Reference in New Issue
Block a user