WIP: Add Event Sources Logic (ActivityPub follows) #86
2 changed files with 16 additions and 17 deletions
|
@ -178,12 +178,23 @@ class Event_Sources {
|
|||
*
|
||||
* @param string $actor The Actor URL.
|
||||
*
|
||||
* @return bool True on success, false on failure.
|
||||
* @return WP_Post|false|null Post data on success, false or null on failure.
|
||||
*/
|
||||
public static function remove_event_source( $actor ) {
|
||||
$actor = true;
|
||||
self::delete_event_source_transients();
|
||||
return $actor;
|
||||
$post_id = Event_Source::get_wp_post_from_activitypub_actor_id( $actor );
|
||||
|
||||
if ( ! $post_id ) {
|
||||
return;
|
||||
}
|
||||
|
||||
$result = wp_delete_post( $post_id, true );
|
||||
|
||||
// If the deletion was successful delete all transients regarding event sources.
|
||||
if ( $result ) {
|
||||
self::delete_event_source_transients();
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -292,18 +303,6 @@ class Event_Sources {
|
|||
return $event_sources;
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove a Follower.
|
||||
*
|
||||
* @param string $event_source The Actor URL.
|
||||
*
|
||||
* @return mixed True on success, false on failure.
|
||||
*/
|
||||
public static function remove( $event_source ) {
|
||||
$post_id = Event_Source::get_wp_post_from_activitypub_actor_id( $event_source );
|
||||
return wp_delete_post( $post_id, true );
|
||||
}
|
||||
|
||||
/**
|
||||
* Queue a hook to run async.
|
||||
*
|
||||
|
|
|
@ -228,7 +228,7 @@ class Event_Sources extends WP_List_Table {
|
|||
$event_sources = array( $event_sources );
|
||||
}
|
||||
foreach ( $event_sources as $event_source ) {
|
||||
Event_Sources_Collection::remove( $event_source );
|
||||
Event_Sources_Collection::remove_event_source( $event_source );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue