From ed358637504fa6d38e3efa05140d35bb409e5e1b Mon Sep 17 00:00:00 2001 From: Jeremy Dormitzer Date: Mon, 28 Jan 2019 09:24:15 -0500 Subject: [PATCH] Do not generate activity id in NonActivityHandler --- src/Activities/NonActivityHandler.php | 11 +---------- test/Activities/NonActivityHandlerTest.php | 7 +------ 2 files changed, 2 insertions(+), 16 deletions(-) diff --git a/src/Activities/NonActivityHandler.php b/src/Activities/NonActivityHandler.php index 71de56e..fe9ecb3 100644 --- a/src/Activities/NonActivityHandler.php +++ b/src/Activities/NonActivityHandler.php @@ -4,7 +4,6 @@ namespace ActivityPub\Activities; use ActivityPub\Activities\OutboxActivityEvent; use ActivityPub\Entities\ActivityPubObject; use ActivityPub\Objects\ContextProvider; -use ActivityPub\Objects\IdProvider; use Symfony\Component\EventDispatcher\EventSubscriberInterface; use Symfony\Component\HttpFoundation\Request; @@ -19,11 +18,6 @@ class NonActivityHandler implements EventSubscriberInterface */ private $contextProvider; - /** - * @var IdProvider - */ - private $idProvider; - const ACTIVITY_TYPES = array( 'Accept', 'Add', 'Announce', 'Arrive', 'Block', 'Create', 'Delete', 'Dislike', @@ -41,11 +35,9 @@ class NonActivityHandler implements EventSubscriberInterface ); } - public function __construct( ContextProvider $contextProvider, - IdProvider $idProvider ) + public function __construct( ContextProvider $contextProvider ) { $this->contextProvider = $contextProvider; - $this->idProvider = $idProvider; } public function handle( OutboxActivityEvent $event ) @@ -75,7 +67,6 @@ class NonActivityHandler implements EventSubscriberInterface $create = array( '@context' => $this->contextProvider->getContext(), 'type' => 'Create', - 'id' => $this->idProvider->getId( $request, "activities" ), 'actor' => $actor['id'], 'object' => $object, ); diff --git a/test/Activities/NonActivityHandlerTest.php b/test/Activities/NonActivityHandlerTest.php index 7908690..fb0d20b 100644 --- a/test/Activities/NonActivityHandlerTest.php +++ b/test/Activities/NonActivityHandlerTest.php @@ -4,7 +4,6 @@ namespace ActivityPub\Test\Activities; use ActivityPub\Activities\OutboxActivityEvent; use ActivityPub\Activities\NonActivityHandler; use ActivityPub\Objects\ContextProvider; -use ActivityPub\Objects\IdProvider; use ActivityPub\Test\TestUtils\TestActivityPubObject; use PHPUnit\Framework\TestCase; use Symfony\Component\HttpFoundation\Request; @@ -14,9 +13,7 @@ class NonActivityHandlerTest extends TestCase public function testNonActivityHandler() { $contextProvider = new ContextProvider(); - $idProvider = $this->createMock( IdProvider::class ); - $idProvider->method( 'getId' )->willReturn( 'id1' ); - $nonActivityHandler = new NonActivityHandler( $contextProvider, $idProvider ); + $nonActivityHandler = new NonActivityHandler( $contextProvider ); $testCases = array( array( 'id' => 'testItWrapsNonObjectActivity', @@ -29,7 +26,6 @@ class NonActivityHandlerTest extends TestCase 'expectedActivity' => array( '@context' => ContextProvider::DEFAULT_CONTEXT, 'type' => 'Create', - 'id' => 'id1', 'actor' => 'https://example.com/actor/1', 'object' => array( 'type' => 'Note', @@ -68,7 +64,6 @@ class NonActivityHandlerTest extends TestCase 'expectedActivity' => array( '@context' => ContextProvider::DEFAULT_CONTEXT, 'type' => 'Create', - 'id' => 'id1', 'actor' => 'https://example.com/actor/1', 'object' => array( 'type' => 'Note',