Skip to content

Commit 620c24a

Browse files
committed
Fix: Send a create as a first activity (#1408)
* Fix: Send a create as a first activity Fix #1406 * simplify code * only Announce `Create`s for now * Add changelog
1 parent 20afc73 commit 620c24a

File tree

4 files changed

+14
-4
lines changed

4 files changed

+14
-4
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8+
## [Unreleased]
9+
10+
### Fixed
11+
12+
* Fixed transition handling of posts to ensure that `Create` and `Update` activities are properly processed.
13+
814
## [5.4.0] - 2025-03-03
915

1016
### Added

includes/class-scheduler.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -413,8 +413,8 @@ public static function schedule_announce_activity( $outbox_activity_id, $activit
413413

414414
$activity_type = \get_post_meta( $outbox_activity_id, '_activitypub_activity_type', true );
415415

416-
// Only if the activity is a Create, Update or Delete.
417-
if ( ! in_array( $activity_type, array( 'Create', 'Update', 'Delete' ), true ) ) {
416+
// Only if the activity is a Create.
417+
if ( ! in_array( $activity_type, array( 'Create' ), true ) ) {
418418
return;
419419
}
420420

@@ -439,6 +439,6 @@ public static function schedule_announce_activity( $outbox_activity_id, $activit
439439
}
440440

441441
// Schedule the outbox item for federation.
442-
self::schedule_outbox_activity_for_federation( $outbox_activity_id, 30 );
442+
self::schedule_outbox_activity_for_federation( $outbox_activity_id, 120 );
443443
}
444444
}

includes/scheduler/class-post.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ public static function schedule_post_activity( $post_id, $post, $update, $post_b
5454

5555
switch ( $new_status ) {
5656
case 'publish':
57-
$type = $update ? 'Update' : 'Create';
57+
$type = ( 'publish' === $old_status ) ? 'Update' : 'Create';
5858
break;
5959

6060
case 'draft':

readme.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,10 @@ For reasons of data protection, it is not possible to see the followers of other
129129

130130
== Changelog ==
131131

132+
= Unreleased =
133+
134+
* Fixed: Transition handling of posts to ensure that `Create` and `Update` activities are properly processed.
135+
132136
= 5.4.0 =
133137

134138
* Added: Upgrade script to fix Follower json representations with unescaped backslashes.

0 commit comments

Comments
 (0)