From c67ddcd760995b97e9904d15b431552f899f63d3 Mon Sep 17 00:00:00 2001 From: Jeremy Dormitzer Date: Sat, 30 Mar 2019 09:35:17 -0400 Subject: [PATCH] Clarify which actor ActivityEvent::actor is --- src/ActivityEventHandlers/AcceptHandler.php | 4 ++-- src/ActivityEventHandlers/ActivityEvent.php | 14 +++++++------- src/ActivityEventHandlers/FollowHandler.php | 2 +- src/ActivityEventHandlers/LikeHandler.php | 2 +- src/ActivityEventHandlers/NonActivityHandler.php | 2 +- 5 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/ActivityEventHandlers/AcceptHandler.php b/src/ActivityEventHandlers/AcceptHandler.php index 7602f5a..3b92b5e 100644 --- a/src/ActivityEventHandlers/AcceptHandler.php +++ b/src/ActivityEventHandlers/AcceptHandler.php @@ -48,7 +48,7 @@ class AcceptHandler implements EventSubscriberInterface if ( $activity['type'] !== 'Accept' ) { return; } - $localActor = $event->getActor(); + $localActor = $event->getReceivingActor(); $followId = $activity['object']; if ( is_array( $followId ) && array_key_exists( 'id', $followId ) ) { $followId = $followId['id']; @@ -118,7 +118,7 @@ class AcceptHandler implements EventSubscriberInterface if ( is_array( $followObjectId ) && array_key_exists( 'id', $followObjectId ) ) { $followObjectId = $followObjectId['id']; } - $localActor = $event->getActor(); + $localActor = $event->getReceivingActor(); if ( $followObjectId !== $localActor['id'] ) { return; } diff --git a/src/ActivityEventHandlers/ActivityEvent.php b/src/ActivityEventHandlers/ActivityEvent.php index d6fcb8b..b2a73cd 100644 --- a/src/ActivityEventHandlers/ActivityEvent.php +++ b/src/ActivityEventHandlers/ActivityEvent.php @@ -17,11 +17,11 @@ class ActivityEvent extends Event protected $activity; /** - * The actor posting or receiving the activity + * The actor whose inbox or outbox is receiving the activity * * @var ActivityPubObject */ - protected $actor; + protected $receivingActor; /** * The current request @@ -37,11 +37,11 @@ class ActivityEvent extends Event */ protected $response; - public function __construct( array $activity, ActivityPubObject $actor, + public function __construct( array $activity, ActivityPubObject $receivingActor, Request $request ) { $this->activity = $activity; - $this->actor = $actor; + $this->receivingActor = $receivingActor; $this->request = $request; } @@ -59,11 +59,11 @@ class ActivityEvent extends Event } /** - * @return ActivityPubObject The actor + * @return ActivityPubObject The actor whose inbox or outbox is receiving the activity */ - public function getActor() + public function getReceivingActor() { - return $this->actor; + return $this->receivingActor; } /** diff --git a/src/ActivityEventHandlers/FollowHandler.php b/src/ActivityEventHandlers/FollowHandler.php index f5198a7..e630215 100644 --- a/src/ActivityEventHandlers/FollowHandler.php +++ b/src/ActivityEventHandlers/FollowHandler.php @@ -43,7 +43,7 @@ class FollowHandler implements EventSubscriberInterface return; } if ( $this->autoAccepts ) { - $localActor = $event->getActor(); + $localActor = $event->getReceivingActor(); $objectId = $activity['object']; if ( is_array( $objectId ) && array_key_exists( 'id', $objectId ) ) { $objectId = $objectId['id']; diff --git a/src/ActivityEventHandlers/LikeHandler.php b/src/ActivityEventHandlers/LikeHandler.php index 29c74d7..30ce573 100644 --- a/src/ActivityEventHandlers/LikeHandler.php +++ b/src/ActivityEventHandlers/LikeHandler.php @@ -71,7 +71,7 @@ class LikeHandler implements EventSubscriberInterface return; } $object = $activity['object']; - $actor = $event->getActor(); + $actor = $event->getReceivingActor(); if ( ! $actor->hasField( 'liked' ) ) { $actor = $this->addCollectionToObject( $actor, 'liked' ); } diff --git a/src/ActivityEventHandlers/NonActivityHandler.php b/src/ActivityEventHandlers/NonActivityHandler.php index ea34465..04119fc 100644 --- a/src/ActivityEventHandlers/NonActivityHandler.php +++ b/src/ActivityEventHandlers/NonActivityHandler.php @@ -35,7 +35,7 @@ class NonActivityHandler implements EventSubscriberInterface if ( in_array( $object['type'], self::activityTypes() ) ) { return; } - $actor = $event->getActor(); + $actor = $event->getReceivingActor(); $create = $this->makeCreate( $object, $actor ); $event->setActivity( $create ); }