Skip to content

Commit

Permalink
Update users => actors (#1164)
Browse files Browse the repository at this point in the history
Non-functional changes that split out the docs updates around users => actors from #593.
  • Loading branch information
obenland authored Jan 15, 2025
1 parent 1981ea6 commit 9bcf0d5
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 25 deletions.
4 changes: 2 additions & 2 deletions includes/collection/class-followers.php
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ public static function remove_follower( $user_id, $actor ) {
* @param int $user_id The ID of the WordPress User.
* @param string $actor The Actor URL.
*
* @return Follower|null The Follower object or null
* @return \Activitypub\Activity\Base_Object|WP_Error|null The Follower object or null
*/
public static function get_follower( $user_id, $actor ) {
global $wpdb;
Expand Down Expand Up @@ -266,7 +266,7 @@ public static function count_followers( $user_id ) {
}

/**
* Returns all Inboxes for a Users Followers.
* Returns all Inboxes for an Actor's Followers.
*
* @param int $user_id The ID of the WordPress User.
*
Expand Down
8 changes: 4 additions & 4 deletions includes/handler/class-update.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ public static function init() {
}

/**
* Handle "Update" requests
* Handle "Update" requests.
*
* @param array $activity The activity-object.
* @param array $activity The Activity object.
*/
public static function handle_update( $activity ) {
$object_type = isset( $activity['object']['type'] ) ? $activity['object']['type'] : '';
Expand Down Expand Up @@ -75,7 +75,7 @@ public static function handle_update( $activity ) {
/**
* Update an Interaction.
*
* @param array $activity The activity-object.
* @param array $activity The Activity object.
*/
public static function update_interaction( $activity ) {
$commentdata = Interactions::update_comment( $activity );
Expand All @@ -102,7 +102,7 @@ public static function update_interaction( $activity ) {
/**
* Update an Actor.
*
* @param array $activity The activity-object.
* @param array $activity The Activity object.
*/
public static function update_actor( $activity ) {
// Update cache.
Expand Down
14 changes: 7 additions & 7 deletions tests/includes/class-test-activity-dispatcher.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@
class Test_Activity_Dispatcher extends ActivityPub_TestCase_Cache_HTTP {

/**
* Users.
* Actors.
*
* @var array[] $users
* @var array[]
*/
public static $users = array(
public static $actors = array(
'[email protected]' => array(
'id' => 'https://example.org/users/username',
'url' => 'https://example.org/users/username',
Expand Down Expand Up @@ -109,7 +109,7 @@ public function test_dispatch_mentions() {
)
);

self::$users['https://example.com/alex'] = array(
self::$actors['https://example.com/alex'] = array(
'id' => 'https://example.com/alex',
'url' => 'https://example.com/alex',
'inbox' => 'https://example.com/alex/inbox',
Expand Down Expand Up @@ -300,10 +300,10 @@ function ( $disabled, $user_id ) {
* @return array|bool
*/
public static function pre_get_remote_metadata_by_actor( $pre, $actor ) {
if ( isset( self::$users[ $actor ] ) ) {
return self::$users[ $actor ];
if ( isset( self::$actors[ $actor ] ) ) {
return self::$actors[ $actor ];
}
foreach ( self::$users as $data ) {
foreach ( self::$actors as $data ) {
if ( $data['url'] === $actor ) {
return $data;
}
Expand Down
10 changes: 5 additions & 5 deletions tests/includes/class-test-mention.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@
class Test_Mention extends \WP_UnitTestCase {

/**
* Users.
* Actors.
*
* @var array
* @var array[]
*/
public static $users = array(
public static $actors = array(
'[email protected]' => array(
'id' => 'https://example.org/users/username',
'url' => 'https://example.org/users/username',
Expand Down Expand Up @@ -133,8 +133,8 @@ public function pre_http_request( $response, $parsed_args, $url ) {
public static function pre_get_remote_metadata_by_actor( $pre, $actor ) {
$actor = ltrim( $actor, '@' );

if ( isset( self::$users[ $actor ] ) ) {
return self::$users[ $actor ];
if ( isset( self::$actors[ $actor ] ) ) {
return self::$actors[ $actor ];
}

return $pre;
Expand Down
14 changes: 7 additions & 7 deletions tests/includes/collection/class-test-followers.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@
class Test_Followers extends \WP_UnitTestCase {

/**
* Users.
* Actors.
*
* @var array[]
*/
public static $users = array(
public static $actors = array(
'[email protected]' => array(
'id' => 'https://example.org/users/username',
'url' => 'https://example.org/users/username',
Expand Down Expand Up @@ -399,8 +399,8 @@ public function test_migration_followers( $followers, $expected_count ) {
add_filter(
'pre_get_remote_metadata_by_actor',
function ( $pre, $actor ) {
if ( isset( self::$users[ $actor ] ) ) {
return self::$users[ $actor ];
if ( isset( self::$actors[ $actor ] ) ) {
return self::$actors[ $actor ];
}
return $pre;
},
Expand Down Expand Up @@ -549,10 +549,10 @@ public function test_get_all_followers() {
* @return array
*/
public static function pre_get_remote_metadata_by_actor( $pre, $actor ) {
if ( isset( self::$users[ $actor ] ) ) {
return self::$users[ $actor ];
if ( isset( self::$actors[ $actor ] ) ) {
return self::$actors[ $actor ];
}
foreach ( self::$users as $data ) {
foreach ( self::$actors as $data ) {
if ( $data['url'] === $actor ) {
return $data;
}
Expand Down

0 comments on commit 9bcf0d5

Please sign in to comment.