Change sequence of checks in handlers. Check for whether we are following the actor first.
All checks were successful
PHP Code Checker / PHP Code Checker (pull_request) Successful in 45s
PHPUnit / PHPUnit – PHP 7.4 (pull_request) Successful in 1m7s
PHPUnit / PHPUnit – PHP 8.0 (pull_request) Successful in 1m5s
PHPUnit / PHPUnit – PHP 8.1 (pull_request) Successful in 1m5s
PHPUnit / PHPUnit – PHP 8.2 (pull_request) Successful in 1m4s
PHPUnit / PHPUnit – PHP 8.3 (pull_request) Successful in 1m11s
PHPUnit / PHPUnit – PHP 8.4 (pull_request) Successful in 1m3s

This commit is contained in:
André Menrath 2025-01-04 10:01:14 +01:00
parent ee7f0a932d
commit 1eec93d342
3 changed files with 11 additions and 11 deletions

View file

@ -41,11 +41,6 @@ class Create {
return;
}
// Check that we are actually following this actor.
if ( ! Event_Sources::actor_is_event_source( $activity['actor'] ) ) {
return false;
}
// Check if Activity is public or not.
if ( ! is_activity_public( $activity ) ) {
return;
@ -56,6 +51,11 @@ class Create {
return;
}
// Check that we are actually following this actor.
if ( ! Event_Sources::actor_is_event_source( $activity['actor'] ) ) {
return false;
}
if ( Event_Sources::is_time_passed( $activity['object']['startTime'] ) ) {
return new \WP_Error(
'event_bridge_for_activitypub_not_accepting_events_from_the_past',

View file

@ -42,7 +42,7 @@ class Undo {
return;
}
// Check that we are actually following/or have a pending follow request this actor.
// Check that we are actually following/or have a pending follow request for this actor.
if ( ! Event_Sources::actor_is_event_source( $activity['actor'] ) ) {
return;
}

View file

@ -41,11 +41,6 @@ class Update {
return;
}
// Check that we are actually following this actor.
if ( ! Event_Sources::actor_is_event_source( $activity['actor'] ) ) {
return;
}
// Check if Activity is public or not.
if ( ! is_activity_public( $activity ) ) {
return;
@ -56,6 +51,11 @@ class Update {
return;
}
// Check that we are actually following this actor.
if ( ! Event_Sources::actor_is_event_source( $activity['actor'] ) ) {
return false;
}
if ( Event_Sources::is_time_passed( $activity['object']['startTime'] ) ) {
return;
}