[CORE][Event] Make all events return \EventResult, enforced at container build time
This commit is contained in:
@@ -46,14 +46,15 @@ use Doctrine\Common\Collections\ExpressionBuilder;
|
||||
use Doctrine\ORM\Query\Expr;
|
||||
|
||||
use Doctrine\ORM\QueryBuilder;
|
||||
use EventResult;
|
||||
use Plugin\PinnedNotes\Controller as C;
|
||||
use Plugin\PinnedNotes\Entity as E;
|
||||
|
||||
use Plugin\PinnedNotes\Entity as E;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
|
||||
class PinnedNotes extends Plugin
|
||||
{
|
||||
public function onAddRoute(Router $r): bool
|
||||
public function onAddRoute(Router $r): EventResult
|
||||
{
|
||||
// Pin and unpin notes
|
||||
$r->connect(id: 'toggle_note_pin', uri_path: '/object/note/{id<\d+>}/pin', target: [C\PinnedNotes::class, 'togglePin']);
|
||||
@@ -73,7 +74,7 @@ class PinnedNotes extends Plugin
|
||||
return Event::next;
|
||||
}
|
||||
|
||||
public function onBeforeFeed(Request $request, &$res): bool
|
||||
public function onBeforeFeed(Request $request, &$res): EventResult
|
||||
{
|
||||
$path = $request->attributes->get('_route');
|
||||
if ($path === 'actor_view_nickname') {
|
||||
@@ -92,7 +93,7 @@ class PinnedNotes extends Plugin
|
||||
return Event::next;
|
||||
}
|
||||
|
||||
public function onCollectionQueryAddJoins(QueryBuilder &$note_qb, QueryBuilder &$actor_qb): bool
|
||||
public function onCollectionQueryAddJoins(QueryBuilder &$note_qb, QueryBuilder &$actor_qb): EventResult
|
||||
{
|
||||
if (!\in_array('pinned_notes', $note_qb->getAllAliases())) {
|
||||
$note_qb->leftJoin(E\PinnedNotes::class, 'pinned_notes', Expr\Join::WITH, 'note.id = pinned_notes.note_id');
|
||||
@@ -100,7 +101,7 @@ class PinnedNotes extends Plugin
|
||||
return Event::next;
|
||||
}
|
||||
|
||||
public function onCollectionQueryCreateExpression(ExpressionBuilder $eb, string $term, ?string $language, ?Actor $actor, &$note_expr, &$actor_expr): bool
|
||||
public function onCollectionQueryCreateExpression(ExpressionBuilder $eb, string $term, ?string $language, ?Actor $actor, &$note_expr, &$actor_expr): EventResult
|
||||
{
|
||||
if ($term === 'pinned:true') {
|
||||
$note_expr = $eb->neq('pinned_notes', null);
|
||||
@@ -114,7 +115,7 @@ class PinnedNotes extends Plugin
|
||||
return Event::next;
|
||||
}
|
||||
|
||||
public function onAddNoteActions(Request $request, Note $note, array &$actions): bool
|
||||
public function onAddNoteActions(Request $request, Note $note, array &$actions): EventResult
|
||||
{
|
||||
$user = Common::user();
|
||||
if ($user->getId() !== $note->getActorId()) {
|
||||
@@ -139,7 +140,7 @@ class PinnedNotes extends Plugin
|
||||
return Event::next;
|
||||
}
|
||||
|
||||
public function onEndShowStyles(array &$styles, string $route): bool
|
||||
public function onEndShowStyles(array &$styles, string $route): EventResult
|
||||
{
|
||||
$styles[] = 'plugins/PinnedNotes/assets/css/pinned-notes.css';
|
||||
return Event::next;
|
||||
@@ -147,7 +148,7 @@ class PinnedNotes extends Plugin
|
||||
|
||||
// Activity Pub handling stuff
|
||||
|
||||
public function onActivityStreamsTwoContext(array &$activity_streams_two_context): bool
|
||||
public function onActivityStreamsTwoContext(array &$activity_streams_two_context): EventResult
|
||||
{
|
||||
$activity_streams_two_context[] = ['toot' => 'http://joinmastodon.org/ns#'];
|
||||
$activity_streams_two_context[] = [
|
||||
@@ -159,7 +160,7 @@ class PinnedNotes extends Plugin
|
||||
return Event::next;
|
||||
}
|
||||
|
||||
public function onActivityPubAddActivityStreamsTwoData(string $type_name, &$type): bool
|
||||
public function onActivityPubAddActivityStreamsTwoData(string $type_name, &$type): EventResult
|
||||
{
|
||||
if ($type_name === 'Person') {
|
||||
$actor = \Plugin\ActivityPub\Util\Explorer::getOneFromUri($type->get('id'));
|
||||
|
Reference in New Issue
Block a user