| @@ -6,12 +6,10 @@ | ||
| 6 | 6 | */ |
| 7 | 7 | |
| 8 | 8 | namespace Activitypub\Scheduler; |
| 9 | 9 | |
| 10 | -use Activitypub\Activity\Activity; | |
| 11 | 10 | use Activitypub\Collection\Actors; |
| 12 | 11 | use Activitypub\Collection\Extra_Fields; |
| 13 | -use Activitypub\Collection\Outbox; | |
| 14 | 12 | |
| 15 | 13 | use function Activitypub\add_to_outbox; |
| 16 | 14 | use function Activitypub\is_user_type_disabled; |
| 17 | 15 | |
| @@ -49,15 +47,8 @@ | ||
| 49 | 47 | \add_action( 'add_option_activitypub_actor_mode', array( self::class, 'blog_user_update' ) ); |
| 50 | 48 | \add_action( 'update_option_activitypub_actor_mode', array( self::class, 'blog_user_update' ) ); |
| 51 | 49 | |
| 52 | 50 | \add_action( 'transition_post_status', array( self::class, 'schedule_post_activity' ), 33, 3 ); |
| 53 | - | |
| 54 | - \add_action( 'post_stuck', array( self::class, 'sticky_post_update' ) ); | |
| 55 | - \add_action( 'post_unstuck', array( self::class, 'sticky_post_update' ) ); | |
| 56 | - | |
| 57 | - // User deletion handling. | |
| 58 | - \add_action( 'delete_user', array( self::class, 'schedule_user_delete' ), 10, 3 ); | |
| 59 | - \add_filter( 'post_types_to_delete_with_user', array( self::class, 'post_types_to_delete_with_user' ) ); | |
| 60 | 51 | } |
| 61 | 52 | |
| 62 | 53 | /** |
| 63 | 54 | * Send a profile update when relevant user meta is updated. |
| @@ -150,55 +141,6 @@ | ||
| 150 | 141 | |
| 151 | 142 | $actor->set_updated( gmdate( ACTIVITYPUB_DATE_TIME_RFC3339, time() ) ); |
| 152 | 143 | |
| 153 | 144 | add_to_outbox( $actor, 'Update', $user_id ); |
| 154 | - } | |
| 155 | - | |
| 156 | - /** | |
| 157 | - * Send a profile update when a post's sticky status changes. | |
| 158 | - * | |
| 159 | - * @param int $post_id The post ID. | |
| 160 | - */ | |
| 161 | - public static function sticky_post_update( $post_id ) { | |
| 162 | - $post = \get_post( $post_id ); | |
| 163 | - | |
| 164 | - if ( ! $post ) { | |
| 165 | - return; | |
| 166 | - } | |
| 167 | - | |
| 168 | - self::schedule_profile_update( $post->post_author ); | |
| 169 | - } | |
| 170 | - | |
| 171 | - /** | |
| 172 | - * Schedule a Delete activity when a user is deleted. | |
| 173 | - * | |
| 174 | - * @param int $user_id The user ID being deleted. | |
| 175 | - */ | |
| 176 | - public static function schedule_user_delete( $user_id ) { | |
| 177 | - // Get the actor before deletion to ensure we have the data. | |
| 178 | - $actor = Actors::get_by_id( $user_id ); | |
| 179 | - if ( \is_wp_error( $actor ) ) { | |
| 180 | - return; | |
| 181 | - } | |
| 182 | - | |
| 183 | - $activity = new Activity(); | |
| 184 | - $activity->set_actor( $actor->get_id() ); | |
| 185 | - $activity->set_object( $actor->get_id() ); | |
| 186 | - $activity->set_type( 'Delete' ); | |
| 187 | - | |
| 188 | - add_to_outbox( $activity, null, $user_id ); | |
| 189 | - } | |
| 190 | - | |
| 191 | - /** | |
| 192 | - * Remove outbox from post types to delete with user. | |
| 193 | - * | |
| 194 | - * Outbox items should not be deleted with the user, because we | |
| 195 | - * need to federate the `Delete` Activities. | |
| 196 | - * | |
| 197 | - * @param array $post_types The post types to delete with user. | |
| 198 | - * | |
| 199 | - * @return array The post types to delete with user without outbox. | |
| 200 | - */ | |
| 201 | - public static function post_types_to_delete_with_user( $post_types ) { | |
| 202 | - return \array_diff( $post_types, array( Outbox::POST_TYPE ) ); | |
| 203 | 145 | } |
| 204 | 146 | } |