Skip to content

Create a persistent Inbox #2009

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 37 commits into from
Aug 1, 2025
Merged

Create a persistent Inbox #2009

merged 37 commits into from
Aug 1, 2025

Conversation

pfefferle
Copy link
Member

@pfefferle pfefferle commented Jul 25, 2025

This PR is primarily intended to log all incoming requests that start with Update and Create, to help debug whether all supported Activity types are being correctly processed.

Proposed changes:

  • Introduce a global Inbox handler to manage all incoming requests, currently limited to Create and Update types.
  • Add an Inbox Collection to persist the received entries.

Other information:

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

Testing instructions:

  • Follow one of your Mastodon Accounts
  • Publish a new status update
  • Check the Inbox for entries

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

A global Inbox handler and persistence layer to log incoming Create and Update requests for debugging and verifying Activity handling.

@pfefferle pfefferle marked this pull request as ready for review July 30, 2025 12:39
@Copilot Copilot AI review requested due to automatic review settings July 30, 2025 12:39
Copilot

This comment was marked as outdated.

@pfefferle pfefferle requested review from obenland and Copilot July 30, 2025 13:41
Copilot

This comment was marked as outdated.

@pfefferle
Copy link
Member Author

@obenland This should be ready to review now.

pfefferle and others added 7 commits July 31, 2025 18:31
Condensed the add_action call in the Inbox class for improved readability and consistency.
Replaces get_by_guid with get method that requires both activity ID and user ID, ensuring inbox items are retrieved per user. Adjusts SQL query to filter by post_author for more accurate results.
@pfefferle pfefferle requested a review from obenland August 1, 2025 16:15
@pfefferle
Copy link
Member Author

@obenland added the user id to the getter.

@pfefferle pfefferle requested a review from Copilot August 1, 2025 18:16
Copy link

@Copilot 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

This PR introduces a global Inbox handler and persistence layer to log incoming ActivityPub Create and Update activities for debugging purposes.

  • Adds a new Inbox collection to persist incoming Create and Update activities
  • Introduces a global Inbox handler that processes and stores activities based on configurable filters
  • Provides admin settings to enable/disable the inbox persistence feature

Reviewed Changes

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

Show a summary per file
File Description
includes/handler/class-inbox.php New global handler to filter and process incoming activities
includes/collection/class-inbox.php New collection class to persist activities as custom posts
includes/class-activitypub.php Registers the inbox post type and meta fields
includes/wp-admin/class-settings.php Adds the inbox persistence setting
includes/wp-admin/class-advanced-settings-fields.php Renders the inbox persistence admin field
includes/functions.php Updates is_activity_public to accept Base_Object instances
includes/debug.php Extends debug UI support to include inbox post type
includes/class-handler.php Initializes the new inbox handler
tests/includes/handler/class-test-inbox.php Test coverage for the inbox handler
tests/includes/collection/class-test-inbox.php Test coverage for the inbox collection
.github/changelog/2009-from-description Changelog entry

Copy link
Member

@obenland obenland left a comment

Choose a reason for hiding this comment

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

Let's :shipit:

We should probably follow it up with a scheduled purge, similar to the Outbox.

@pfefferle pfefferle merged commit 1905854 into trunk Aug 1, 2025
12 checks passed
@pfefferle pfefferle deleted the add/inbox branch August 1, 2025 18:52
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.

3 participants