revert latest changes to simplify dispatching for now
This commit is contained in:
parent
a8fe587f91
commit
255ace3ae6
1 changed files with 2 additions and 28 deletions
|
@ -69,37 +69,11 @@ class Activity_Dispatcher {
|
||||||
// check if a migration is needed before sending new posts
|
// check if a migration is needed before sending new posts
|
||||||
Migration::maybe_migrate();
|
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 = new Activity( $activity_type );
|
||||||
$activitypub_activity->from_post( $activitypub_post );
|
$activitypub_activity->from_post( $activitypub_post );
|
||||||
|
|
||||||
if ( $actor ) {
|
$user_id = $activitypub_post->get_user_id();
|
||||||
$activitypub_activity->set_actor( $actor );
|
$follower_inboxes = Followers::get_inboxes( $user_id );
|
||||||
}
|
|
||||||
|
|
||||||
$follower_inboxes = Followers::get_inboxes( $user_id );
|
|
||||||
$mentioned_inboxes = Mention::get_inboxes( $activitypub_activity->get_cc() );
|
$mentioned_inboxes = Mention::get_inboxes( $activitypub_activity->get_cc() );
|
||||||
|
|
||||||
$inboxes = array_merge( $follower_inboxes, $mentioned_inboxes );
|
$inboxes = array_merge( $follower_inboxes, $mentioned_inboxes );
|
||||||
|
|
Loading…
Reference in a new issue