Skip to content

Conversation

@obenland
Copy link
Member

Proposed changes:

  • Fixed the add_follower CLI command to properly handle the --user global flag by using get_current_user_id() instead of manually parsing the flag
  • Removed unused Actors import

The command was incorrectly trying to manually handle the --user flag through $assoc_args. Since --user is a WP-CLI global flag, it's automatically handled by WP-CLI which sets the current user context before command execution.

Other information:

  • Have you written new tests for your changes, if applicable?

Testing instructions:

  1. Run wp activitypub add_follower https://example.com/@user --user=1
  2. Verify the follower is added to user ID 1
  3. Run wp --user=2 activitypub add_follower https://example.com/@another
  4. Verify the follower is added to user ID 2 (using the alternative global flag syntax)

The command was incorrectly trying to manually handle the --user flag
through $assoc_args. Since --user is a WP-CLI global flag, it's
automatically handled by WP-CLI which sets the current user context
before command execution. The fix uses get_current_user_id() instead,
which correctly retrieves the user set by WP-CLI's global flag handling.
@Copilot Copilot AI review requested due to automatic review settings October 24, 2025 21:41
@obenland obenland added the Skip Changelog Disables the "Changelog Updated" action for PRs where changelog entries are not necessary. label Oct 24, 2025
@obenland obenland self-assigned this Oct 24, 2025
@obenland obenland requested a review from pfefferle October 24, 2025 21:42
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Fixes the add_follower CLI command to correctly use WP-CLI's global --user flag by leveraging get_current_user_id() instead of manually parsing the flag from command arguments.

  • Replaced manual --user flag parsing with get_current_user_id() to respect WP-CLI's automatic user context handling
  • Removed unused Actors import that was only needed for the now-removed default value
  • Simplified function signature by removing the unused $assoc_args parameter

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Skip Changelog Disables the "Changelog Updated" action for PRs where changelog entries are not necessary.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant