| @@ -7,10 +7,9 @@ | ||
| 7 | 7 | |
| 8 | 8 | namespace Activitypub\Handler; |
| 9 | 9 | |
| 10 | 10 | use Activitypub\Collection\Interactions; |
| 11 | -use Activitypub\Collection\Remote_Posts; | |
| 12 | -use Activitypub\Tombstone; | |
| 11 | +use Activitypub\Collection\Posts; | |
| 13 | 12 | |
| 14 | 13 | use function Activitypub\get_activity_visibility; |
| 15 | 14 | use function Activitypub\is_activity_reply; |
| 16 | 15 | use function Activitypub\is_quote_activity; |
| @@ -26,9 +25,8 @@ | ||
| 26 | 25 | */ |
| 27 | 26 | public static function init() { |
| 28 | 27 | \add_action( 'activitypub_handled_inbox_create', array( self::class, 'handle_create' ), 10, 3 ); |
| 29 | 28 | \add_filter( 'activitypub_validate_object', array( self::class, 'validate_object' ), 10, 3 ); |
| 30 | - \add_action( 'post_activitypub_add_to_outbox', array( self::class, 'maybe_unbury' ), 10, 2 ); | |
| 31 | 29 | } |
| 32 | 30 | |
| 33 | 31 | /** |
| 34 | 32 | * Handles "Create" requests. |
| @@ -109,9 +107,9 @@ | ||
| 109 | 107 | if ( ! \get_option( 'activitypub_create_posts', false ) ) { |
| 110 | 108 | return false; |
| 111 | 109 | } |
| 112 | 110 | |
| 113 | - $existing_post = Remote_Posts::get_by_guid( $activity['object']['id'] ); | |
| 111 | + $existing_post = Posts::get_by_guid( $activity['object']['id'] ); | |
| 114 | 112 | |
| 115 | 113 | // If post exists, call update action. |
| 116 | 114 | if ( $existing_post instanceof \WP_Post ) { |
| 117 | 115 | Update::handle_update( $activity, (array) $user_ids, $activity_object ); |
| @@ -118,9 +116,9 @@ | ||
| 118 | 116 | |
| 119 | 117 | return false; |
| 120 | 118 | } |
| 121 | 119 | |
| 122 | - return Remote_Posts::add( $activity, $user_ids ); | |
| 120 | + return Posts::add( $activity, $user_ids ); | |
| 123 | 121 | } |
| 124 | 122 | |
| 125 | 123 | /** |
| 126 | 124 | * Validate the object. |
| @@ -150,28 +148,6 @@ | ||
| 150 | 148 | return false; |
| 151 | 149 | } |
| 152 | 150 | |
| 153 | 151 | return $valid; |
| 154 | - } | |
| 155 | - | |
| 156 | - /** | |
| 157 | - * Remove a URL from the tombstone registry when a Create or Update activity is sent. | |
| 158 | - * | |
| 159 | - * This handles the case where a post was soft-deleted (visibility changed to local/private) | |
| 160 | - * and then later changed back to public. The Create/Update activity indicates the post is being | |
| 161 | - * re-federated, so we remove it from the tombstone registry. | |
| 162 | - * | |
| 163 | - * @param int $outbox_id The ID of the outbox activity. | |
| 164 | - * @param \Activitypub\Activity\Activity $activity The Activity object. | |
| 165 | - */ | |
| 166 | - public static function maybe_unbury( $outbox_id, $activity ) { | |
| 167 | - if ( ! \in_array( $activity->get_type(), array( 'Create', 'Update' ), true ) ) { | |
| 168 | - return; | |
| 169 | - } | |
| 170 | - | |
| 171 | - $object = $activity->get_object(); | |
| 172 | - | |
| 173 | - if ( $object ) { | |
| 174 | - Tombstone::remove( $object->get_id(), $object->get_url() ); | |
| 175 | - } | |
| 176 | 152 | } |
| 177 | 153 | } |