Skip to content

Fix Accept recipients for wrapped follows#3526

Merged
pfefferle merged 8 commits into
trunkfrom
fix/flipboard-accept-follow-recipient
Jul 9, 2026
Merged

Fix Accept recipients for wrapped follows#3526
pfefferle merged 8 commits into
trunkfrom
fix/flipboard-accept-follow-recipient

Conversation

@akirk

@akirk akirk commented Jul 8, 2026

Copy link
Copy Markdown
Member

Proposed changes:

  • Fix follow Accept handling for services such as Flipboard when the incoming Accept wraps the original Follow and omits top-level to / cc addressing. See this Mastodon conversation.
  • Resolve the local recipient from the embedded Follow actor only when the wrapper is an Accept or Reject and the embedded object is a Follow.
  • Add regression coverage for the Flipboard-style Accept shape.

Other information:

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

Testing instructions:

  • Example failure reproduced with a local follow from https://alex.kirk.at/author/alex/ to https://flipboard.com/users/BBCNews.
  • Flipboard responded with an Accept like:
    • actor: https://flipboard.com/users/BBCNews
    • no top-level to, cc, or audience
    • embedded object.type: Follow
    • embedded object.actor: https://alex.kirk.at/author/alex/
    • embedded object.object: https://flipboard.com/users/BBCNews
  • Before this change, recipient extraction only found https://flipboard.com/users/BBCNews, so the shared inbox resolved zero local recipients and the follow stayed pending.
  • After this change, the embedded Follow actor resolves to the local user and the pending follow can move to accepted.
  • Run npm run env-test -- --filter=test_get_local_recipients_accept_follow_uses_object_actor.

Changelog entry

  • Automatically create a changelog entry from the details below.
Changelog Entry Details

Significance

  • Patch
  • Minor
  • Major

Type

  • Added - for new features
  • Changed - for changes in existing functionality
  • Deprecated - for soon-to-be removed features
  • Removed - for now removed features
  • Fixed - for any bug fixes
  • Security - in case of vulnerabilities

Message

Fix follow requests from some fediverse services staying pending after they are accepted.

Copilot AI review requested due to automatic review settings July 8, 2026 15:27
@akirk akirk self-assigned this Jul 8, 2026
@akirk akirk requested a review from a team July 8, 2026 15:27

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR fixes shared-inbox recipient resolution for Accept/Reject activities that wrap a Follow, ensuring the local recipient can be derived from the embedded Follow’s actor even when top-level addressing fields are missing.

Changes:

  • Extend Inbox_Controller::get_local_recipients() to include the embedded Follow actor as a candidate local recipient for Accept/Reject.
  • Add a PHPUnit regression test covering an Accept that wraps a Follow (Flipboard-like shape).
  • Add a patch-level changelog entry for the fix.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.

File Description
includes/rest/class-inbox-controller.php Adds embedded-object actor as a recipient for Accept/Reject activities.
tests/phpunit/tests/includes/rest/class-test-inbox-controller.php Adds regression coverage for resolving local recipients from an embedded Follow actor.
.github/changelog/3526-from-description Documents the user-facing bugfix in the changelog.

Comment thread includes/rest/class-inbox-controller.php Outdated
Comment thread tests/phpunit/tests/includes/rest/class-test-inbox-controller.php
Comment thread tests/phpunit/tests/includes/rest/class-test-inbox-controller.php
pfefferle added 2 commits July 8, 2026 22:38
Move the embedded-Follow-actor recipient resolution out of the inbox controller and
into extract_recipients_from_activity, where all activity recipient extraction lives,
so an Accept/Reject that carries no top-level addressing is still delivered to the
local Follow actor. Add direct coverage for the new behavior and give the recipient
and mailer fixtures an explicit activity type.

Claude-Session: https://claude.ai/code/session_01HDA9QR3bJoqM7NhnhT1whg
pfefferle
pfefferle previously approved these changes Jul 8, 2026

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 5 out of 5 changed files in this pull request and generated 7 comments.

Comment thread includes/functions-activity.php
Comment thread tests/phpunit/tests/includes/class-test-functions-activity.php
Comment thread tests/phpunit/tests/includes/class-test-mailer.php Outdated
Comment thread tests/phpunit/tests/includes/class-test-mailer.php Outdated
Comment thread tests/phpunit/tests/includes/class-test-mailer.php Outdated
Comment thread tests/phpunit/tests/includes/class-test-mailer.php Outdated
Comment thread tests/phpunit/tests/includes/class-test-mailer.php Outdated
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
pfefferle and others added 2 commits July 8, 2026 23:22
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Copilot's auto-fix corrected two of the mocked-actor fixtures from the Activity type
Create to the actor type Person; apply the same to the three it missed so the actor
mocks are accurate.

Claude-Session: https://claude.ai/code/session_01HDA9QR3bJoqM7NhnhT1whg

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.

Comment thread includes/functions-activity.php
Add type checks in `extract_recipients_from_activity()` so Accept/Reject activities only read `object['actor']` when `object` is present and an array. This prevents invalid array access when the embedded object is missing or represented as a scalar.
@pfefferle pfefferle merged commit 69bf25c into trunk Jul 9, 2026
10 checks passed
@pfefferle pfefferle deleted the fix/flipboard-accept-follow-recipient branch July 9, 2026 04:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants