Skip to content
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .github/changelog/2094-from-description
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: minor
Type: changed


8 changes: 6 additions & 2 deletions includes/collection/class-following.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ class Following {
* @param \WP_Post|int $post The ID of the remote Actor.
* @param int $user_id The ID of the WordPress User.
*
* @return int|false|\WP_Post|\WP_Error The Outbox ID or false on failure, the Actor post or a WP_Error.
* @return \WP_Post|\WP_Error The Actor post or a WP_Error.
*/
public static function follow( $post, $user_id ) {
$post = \get_post( $post );
Expand Down Expand Up @@ -88,7 +88,11 @@ public static function follow( $post, $user_id ) {
$follow->set_object( $post->guid );
$follow->set_to( array( $post->guid ) );

return add_to_outbox( $follow, null, $user_id, ACTIVITYPUB_CONTENT_VISIBILITY_PRIVATE );
$id = add_to_outbox( $follow, null, $user_id, ACTIVITYPUB_CONTENT_VISIBILITY_PRIVATE );

if ( ! $id ) {
return new \WP_Error( 'activitypub_follow_failed', 'Failed to add follow to outbox' );
}
}

return $post;
Expand Down
2 changes: 1 addition & 1 deletion includes/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -1545,7 +1545,7 @@ function add_to_outbox( $data, $activity_type = null, $user_id = 0, $content_vis
* @param string|int $remote_actor The Actor URL, WebFinger Resource or Post-ID of the remote Actor.
* @param int $user_id The ID of the WordPress User.
*
* @return int|false|\WP_Post|\WP_Error The Outbox ID or false on failure, the Actor post or a WP_Error.
* @return \WP_Post|\WP_Error The Actor post or a WP_Error.
*/
function follow( $remote_actor, $user_id ) {
if ( \is_numeric( $remote_actor ) ) {
Expand Down
Loading