Skip to content

Commit d78a431

Browse files
authored
Only Announce Creates (#1551)
Only `Announce` the `Create` activities and use `Base_Object::TYPES` instead of array.
1 parent d73f4ff commit d78a431

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

includes/class-scheduler.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
namespace Activitypub;
99

1010
use Activitypub\Activity\Activity;
11+
use Activitypub\Activity\Base_Object;
1112
use Activitypub\Scheduler\Post;
1213
use Activitypub\Scheduler\Actor;
1314
use Activitypub\Scheduler\Comment;
@@ -412,8 +413,8 @@ public static function schedule_announce_activity( $outbox_activity_id, $activit
412413
return;
413414
}
414415

415-
// Only if the activity is a Create, Update or Delete.
416-
if ( ! in_array( $activity->get_type(), array( 'Create', 'Update', 'Delete' ), true ) ) {
416+
// Only if the activity is a Create.
417+
if ( 'Create' !== $activity->get_type() ) {
417418
return;
418419
}
419420

@@ -422,7 +423,7 @@ public static function schedule_announce_activity( $outbox_activity_id, $activit
422423
}
423424

424425
// Check if the object is an article, image, audio, video, event, or document and ignore profile updates and other activities.
425-
if ( ! in_array( $activity->get_object()->get_type(), array( 'Note', 'Article', 'Image', 'Audio', 'Video', 'Event', 'Document' ), true ) ) {
426+
if ( ! in_array( $activity->get_object()->get_type(), Base_Object::TYPES, true ) ) {
426427
return;
427428
}
428429

0 commit comments

Comments
 (0)