diff --git a/src/Activities/ActivityEvent.php b/src/Activities/ActivityEvent.php index 3f0300e..952dffa 100644 --- a/src/Activities/ActivityEvent.php +++ b/src/Activities/ActivityEvent.php @@ -4,6 +4,7 @@ namespace ActivityPub\Activities; use ActivityPub\Entities\ActivityPubObject; use Symfony\Component\EventDispatcher\Event; use Symfony\Component\HttpFoundation\Request; +use Symfony\Component\HttpFoundation\Response; class ActivityEvent extends Event { @@ -28,6 +29,13 @@ class ActivityEvent extends Event */ protected $request; + /** + * The response + * + * @var Response + */ + protected $response; + public function __construct( array $activity, ActivityPubObject $actor, Request $request ) { @@ -64,5 +72,18 @@ class ActivityEvent extends Event { return $this->request; } + + /** + * @return Response The response + */ + public function getResponse() + { + return $this->response; + } + + public function setResponse( Response $response ) + { + $this->response = $response; + } } ?> diff --git a/src/Controllers/PostController.php b/src/Controllers/PostController.php index 9261862..81fa69f 100644 --- a/src/Controllers/PostController.php +++ b/src/Controllers/PostController.php @@ -68,7 +68,7 @@ class PostController $actorWithInbox = $inboxField->getObject(); $event = new InboxActivityEvent( $activity, $actorWithInbox, $request ); $this->eventDispatcher->dispatch( InboxActivityEvent::NAME, $event ); - return; + return $event->getResponse(); } $outboxField = $object->getReferencingField( 'outbox' ); if ( $outboxField ) { @@ -84,14 +84,13 @@ class PostController } $event = new OutboxActivityEvent( $activity, $actorWithOutbox, $request ); $this->eventDispatcher->dispatch( OutboxActivityEvent::NAME, $event ); - return; + return $event->getResponse(); } throw new MethodNotAllowedHttpException( array( Request::METHOD_GET ) ); } private function getActivityActor( array $activity ) { - xdebug_break(); $actor = $activity['actor']; if ( is_array( $actor ) && array_key_exists( 'id', $actor ) ) { return $this->objectsService->dereference( $actor['id'] );