Respond correctly

This commit is contained in:
Jeremy Dormitzer 2019-04-14 12:27:32 -04:00
parent 909fae3dfa
commit 7536c42260

View File

@ -6,6 +6,7 @@ use ActivityPub\Objects\CollectionsService;
use ActivityPub\Objects\IdProvider; use ActivityPub\Objects\IdProvider;
use ActivityPub\Objects\ObjectsService; use ActivityPub\Objects\ObjectsService;
use Symfony\Component\EventDispatcher\EventSubscriberInterface; use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Symfony\Component\HttpFoundation\Response;
class ActivityPersister implements EventSubscriberInterface class ActivityPersister implements EventSubscriberInterface
{ {
@ -50,6 +51,7 @@ class ActivityPersister implements EventSubscriberInterface
} else { } else {
$this->objectsService->persist( $activity ); $this->objectsService->persist( $activity );
} }
$event->setResponse( new Response( 'Activity accepted', Response::HTTP_OK ) );
} }
public function persistActivityToOutbox( OutboxActivityEvent $event ) public function persistActivityToOutbox( OutboxActivityEvent $event )
@ -64,5 +66,8 @@ class ActivityPersister implements EventSubscriberInterface
} else { } else {
$this->objectsService->persist( $activity ); $this->objectsService->persist( $activity );
} }
$event->setResponse( new Response(
'Activity accepted', Response::HTTP_CREATED, array( 'Location' => $activity['id'] )
) );
} }
} }