-
Notifications
You must be signed in to change notification settings - Fork 81
Delete: Self-Destruct #2046
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
base: trunk
Are you sure you want to change the base?
Delete: Self-Destruct #2046
Conversation
Improves the self_destruct method to schedule deletion for all users with the 'activitypub' capability, logs each scheduled user, and updates messaging for clarity. Adds an option to mark the deletion process and instructs users to keep the plugin active until completion.
Enhanced the self_destruct command to provide clearer warnings, detailed process steps, and progress feedback when deleting a blog from the Fediverse. Added checks for user existence, improved error handling, and clarified next steps for users after scheduling deletions.
Implements a mechanism to check when all Delete activities for ActivityPub self-destruct are processed, removes the self-destruct flag, and displays an admin notice upon completion. Enhances user feedback and ensures proper cleanup after self-destruct operations.
Changed the action hook from 'activitypub_self_destruct_processing_complete' to 'activitypub_outbox_processing_complete' and updated the method signature for check_self_destruct_completion to accept only inboxes and JSON. Adjusted post type, status, and meta key in the pending deletes query for consistency with Outbox implementation.
Co-authored-by: Copilot <[email protected]>
There was a problem hiding this 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 implements a self-destruct feature for ActivityPub that allows users to completely remove their blog from the Fediverse by sending Delete activities to all followers. The implementation provides a CLI command with confirmation prompts, automatic completion tracking, and admin notifications when the process finishes.
- Adds
wp activitypub self_destruct
CLI command with safety confirmations and progress tracking - Implements completion detection logic that monitors pending Delete activities and notifies when finished
- Provides admin notice functionality to inform users when the self-destruct process is complete
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.
File | Description |
---|---|
includes/class-cli.php | Implements the main self-destruct CLI command with user confirmation, progress tracking, and scheduling of Delete activities |
includes/class-scheduler.php | Adds completion detection logic to monitor pending Delete activities and trigger notifications |
includes/wp-admin/class-admin.php | Adds admin notice display for self-destruct completion notifications |
.github/changelog/2046-from-description | Changelog entry for the new feature |
Replaces direct parameters with an Activity object when adding a 'Delete' activity to the outbox. This change improves consistency and leverages the Activity class for better structure.
</p> | ||
</div> | ||
<?php | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With this being triggered from CLI, how about sending an email on completion instead?
\add_option( 'activitypub_self_destruct', true ); | ||
|
||
// Hook into outbox processing completion to notify when self-destruct is done. | ||
\add_action( 'activitypub_outbox_processing_complete', array( Scheduler::class, 'check_self_destruct_completion' ), 10, 2 ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this work? Any outbox processing should happen in separate threads where this action would not be added.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good question!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
any idea where to put this instead? does it cost too much to add the hook, to be called on every activitypub_outbox_processing_complete
call?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's probably not too expensive to put into the Dispatcher, but kind of a bummer given that this will almost never run.
Do we need the notification? Could we give them a CLI command to keep track of the scheduled events manually? Like, tell them to check wp cron event list XYZ
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This felt like the best UX. We should get sure that this delete is properly processed, because otherwise this could end up in a big inconsistancy that can never be properly cleaned up!?
This PR implements a self-destruct feature for ActivityPub that allows users to remove their blog from the Fediverse by sending Delete activities to all followers. The implementation includes a CLI command, completion tracking, and admin notifications.
Proposed changes:
wp activitypub self_destruct
CLI command with confirmation prompts and progress trackingOther information:
Testing instructions:
wp activitypub self_destruct
in the CLIDelete
ActivitiesChangelog entry
Changelog Entry Details
Significance
Type
Message
Adds a self-destruct feature to remove a blog from the Fediverse by sending Delete activities to followers.