PluginProbe
ActivityPub / 7.8.2
ActivityPub v7.8.2
9.3.1 9.3.0 9.2.2 9.2.1 9.2.0 9.1.0 9.0.2 9.0.1 9.0.0 8.3.0 8.2.1 8.2.0 8.1.1 1.0.5 1.0.6 1.0.7 1.0.8 1.0.9 1.1.0 1.2.0 1.3.0 2.0.0 2.0.1 2.1.0 2.1.1 All 160 releases
← All changes | includes/handler/class-create.php +3 -27 9.1.07.8.2 View file →
@@ -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 }