Skip to content
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

Outbox: Add upgrade script to populate outbox items #1175

Open
wants to merge 9 commits into
base: add/outbox-collection
Choose a base branch
from

Conversation

obenland
Copy link
Member

@obenland obenland commented Jan 16, 2025

Proposed changes:

  • Adds activitypub_upgrade event for async upgrades with locking.
  • Adds upgrade callbacks to create outbox items for posts and comments.
  • Adds custom add_to_outbox function that skips any federation considerations.
  • Adds tests for the async upgrade event, and outbox generation callbacks.

Other information:

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

Testing instructions:

  • Not quite sure yet.

@obenland obenland added [Status] In Progress Skip Changelog Disables the "Changelog Updated" action for PRs where changelog entries are not necessary. labels Jan 16, 2025
@obenland obenland requested a review from a team January 16, 2025 21:52
@obenland obenland self-assigned this Jan 16, 2025
@pfefferle
Copy link
Member

pfefferle commented Jan 17, 2025

The risk here is, that all added items will be queued for federation again and because these are quite a lot, it could cause quite some traffic. I think we have to find a way to add historical data without publishing them.

@obenland
Copy link
Member Author

obenland commented Jan 17, 2025

I was hoping the add_filter( 'pre_schedule_event', '__return_false' ); filter would prevent these federation jobs from being scheduled

@pfefferle
Copy link
Member

Oh, haven't seen that. True, but this might be only for the moment they were added... the state of the post will still be "pending for federation", so it will be handled at one time...

@obenland
Copy link
Member Author

da26595 adds a localized version of add_to_outbox() that skips all the federation business

@pfefferle
Copy link
Member

Does it make sense to have some of the functions in the collection, instead of the migration?

Should we have dedicated classes for bigger migrations, like for example Activitypub\Migration\Outbox?

array(
'post_type' => 'ap_outbox',
'posts_per_page' => -1,
'post_status' => 'draft',
Copy link
Member

Choose a reason for hiding this comment

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

I think we should use the status to track the process of an item. If an item is added, I would set it to pending and if it was sent to the fediverse, I would change that to publish.

@obenland obenland closed this Jan 21, 2025
@obenland obenland deleted the add/outbox-migration branch January 21, 2025 19:49
@obenland obenland restored the add/outbox-migration branch January 21, 2025 21:56
@obenland obenland reopened this Jan 21, 2025
@obenland
Copy link
Member Author

obenland commented Jan 21, 2025

Does it make sense to have some of the functions in the collection, instead of the migration?

Sure, what are you thinking?

Should we have dedicated classes for bigger migrations, like for example Activitypub\Migration\Outbox?

At some point I'd like to suggest renaming Migration to Upgrade to align with Core and free up the namespace for any future content migration work. Not sure we need separate classes for upgrade routines (yet). As a matter of fact, I created activitypub_upgrade to make it more reusable for async upgrades and eventually move the existing async routines over to it (reusing more code).

@obenland obenland force-pushed the add/outbox-migration branch from fea0686 to 45b3b2d Compare January 21, 2025 22:18
@obenland obenland marked this pull request as ready for review January 21, 2025 22:24
@obenland obenland requested a review from a team January 21, 2025 22:29
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. [Status] In Progress
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants