revert latest changes to simplify dispatching for now

This commit is contained in:
Matthias Pfefferle 2023-06-21 15:44:46 +02:00
parent a8fe587f91
commit 255ace3ae6

View file

@ -69,36 +69,10 @@ class Activity_Dispatcher {
// check if a migration is needed before sending new posts
Migration::maybe_migrate();
// send Blog-User-Activity
self::send_user_activity( $activitypub_post, $activity_type );
}
/**
* Send Activities to followers and mentioned users.
*
* @param Post $activitypub_post The ActivityPub Post.
* @param string $activity_type The Activity-Type.
* @param int $user_id The User-ID.
*
* @return void
*/
public static function send_user_activity( Post $activitypub_post, $activity_type, $user_id = null ) {
if ( $user_id ) {
$user = User_Factory::get_by_id( $user_id );
$user_id = $user->get_id();
$actor = $user->get_url();
} else {
$user_id = $activitypub_post->get_post_author();
$actor = null;
}
$activitypub_activity = new Activity( $activity_type );
$activitypub_activity->from_post( $activitypub_post );
if ( $actor ) {
$activitypub_activity->set_actor( $actor );
}
$user_id = $activitypub_post->get_user_id();
$follower_inboxes = Followers::get_inboxes( $user_id );
$mentioned_inboxes = Mention::get_inboxes( $activitypub_activity->get_cc() );