Do not generate activity id in NonActivityHandler

This commit is contained in:
Jeremy Dormitzer 2019-01-28 09:24:15 -05:00
parent a0bc39b9f8
commit ed35863750
2 changed files with 2 additions and 16 deletions

View File

@ -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,
);

View File

@ -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',