Skip to content

Commit

Permalink
Merge branch 'trunk' into fix/duplicate-content-check
Browse files Browse the repository at this point in the history
  • Loading branch information
pfefferle authored Feb 13, 2025
2 parents dad7cc7 + 63fb115 commit 4e43887
Show file tree
Hide file tree
Showing 15 changed files with 213 additions and 135 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

* Batch Outbox-Processing.
* Outbox processed events get logged in Stream and show any errors returned from inboxes.
* Outbox items older than 6 months will be purged to avoid performance issues.
* REST API endpoints for likes and shares.

### Changed
Expand All @@ -25,6 +26,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
* `object_id_to_comment` returns a commment now, even if there are more than one matching comment in the DB.
* Integration of content-visibility setup in the block editor.
* Update CLI commands to the new scheduler refactorings.
* `Activity::set_object` falsely overwrites the Activity-ID with a default.

## [5.1.0] - 2025-02-06

Expand Down
71 changes: 39 additions & 32 deletions includes/activity/class-activity.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,38 @@
*
* @see https://www.w3.org/TR/activitystreams-core/#activities
* @see https://www.w3.org/TR/activitystreams-core/#intransitiveactivities
*
* @method string|array|null get_actor() Gets one or more entities that performed or are expected to perform the activity.
* @method string|null get_id() Gets the object's unique global identifier.
* @method string get_type() Gets the type of the object.
* @method string|null get_name() Gets the natural language name of the object.
* @method string|null get_url() Gets the URL of the object.
* @method string|null get_summary() Gets the natural language summary of the object.
* @method string|null get_published() Gets the date and time the object was published in ISO 8601 format.
* @method string|null get_updated() Gets the date and time the object was updated in ISO 8601 format.
* @method string|null get_attributed_to() Gets the entity attributed as the original author.
* @method array|string|null get_cc() Gets the secondary recipients of the object.
* @method array|string|null get_to() Gets the primary recipients of the object.
* @method array|null get_attachment() Gets the attachment property of the object.
* @method array|null get_icon() Gets the icon property of the object.
* @method array|null get_image() Gets the image property of the object.
* @method Base_Object|string|null get_object() Gets the direct object of the activity.
* @method array|string|null get_in_reply_to() Gets the objects this object is in reply to.
*
* @method Activity set_actor( string|array $actor ) Sets one or more entities that performed the activity.
* @method Activity set_id( string $id ) Sets the object's unique global identifier.
* @method Activity set_type( string $type ) Sets the type of the object.
* @method Activity set_name( string $name ) Sets the natural language name of the object.
* @method Activity set_url( string $url ) Sets the URL of the object.
* @method Activity set_summary( string $summary ) Sets the natural language summary of the object.
* @method Activity set_published( string $published ) Sets the date and time the object was published in ISO 8601 format.
* @method Activity set_updated( string $updated ) Sets the date and time the object was updated in ISO 8601 format.
* @method Activity set_attributed_to( string $attributed_to ) Sets the entity attributed as the original author.
* @method Activity set_cc( array|string $cc ) Sets the secondary recipients of the object.
* @method Activity set_to( array|string $to ) Sets the primary recipients of the object.
* @method Activity set_attachment( array $attachment ) Sets the attachment property of the object.
* @method Activity set_icon( array $icon ) Sets the icon property of the object.
* @method Activity set_image( array $image ) Sets the image property of the object.
*/
class Activity extends Base_Object {
const JSON_LD_CONTEXT = array(
Expand All @@ -40,10 +72,7 @@ class Activity extends Base_Object {
*
* @see https://www.w3.org/TR/activitystreams-vocabulary/#dfn-object-term
*
* @var string
* | Base_Object
* | Link
* | null
* @var string|Base_Object|null
*/
protected $object;

Expand All @@ -55,11 +84,7 @@ class Activity extends Base_Object {
*
* @see https://www.w3.org/TR/activitystreams-vocabulary/#dfn-actor
*
* @var string
* | \ActivityPhp\Type\Extended\AbstractActor
* | array<Actor>
* | array<Link>
* | Link
* @var string|array
*/
protected $actor;

Expand All @@ -74,11 +99,7 @@ class Activity extends Base_Object {
*
* @see https://www.w3.org/TR/activitystreams-vocabulary/#dfn-target
*
* @var string
* | ObjectType
* | array<ObjectType>
* | Link
* | array<Link>
* @var string|array
*/
protected $target;

Expand All @@ -90,10 +111,7 @@ class Activity extends Base_Object {
*
* @see https://www.w3.org/TR/activitystreams-vocabulary/#dfn-result
*
* @var string
* | ObjectType
* | Link
* | null
* @var string|Base_Object
*/
protected $result;

Expand All @@ -106,9 +124,6 @@ class Activity extends Base_Object {
* @see https://www.w3.org/TR/activitystreams-vocabulary/#dfn-replies
*
* @var array
* | ObjectType
* | Link
* | null
*/
protected $replies;

Expand All @@ -122,10 +137,7 @@ class Activity extends Base_Object {
*
* @see https://www.w3.org/TR/activitystreams-vocabulary/#dfn-origin
*
* @var string
* | ObjectType
* | Link
* | null
* @var string|array
*/
protected $origin;

Expand All @@ -135,10 +147,7 @@ class Activity extends Base_Object {
*
* @see https://www.w3.org/TR/activitystreams-vocabulary/#dfn-instrument
*
* @var string
* | ObjectType
* | Link
* | null
* @var string|array
*/
protected $instrument;

Expand All @@ -151,8 +160,6 @@ class Activity extends Base_Object {
* @see https://www.w3.org/TR/activitypub/#object-without-create
*
* @param array|string|Base_Object|Link|null $data Activity object.
*
* @return void
*/
public function set_object( $data ) {
// Convert array to object.
Expand All @@ -171,7 +178,7 @@ public function set_object( $data ) {
$this->set( 'object', $data );

// Check if `$data` is a URL and use it to generate an ID then.
if ( is_string( $data ) && filter_var( $data, FILTER_VALIDATE_URL ) ) {
if ( is_string( $data ) && filter_var( $data, FILTER_VALIDATE_URL ) && ! $this->get_id() ) {
$this->set( 'id', $data . '#activity-' . strtolower( $this->get_type() ) . '-' . time() );

return;
Expand Down
6 changes: 2 additions & 4 deletions includes/activity/class-actor.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,7 @@ class Actor extends Base_Object {
*
* @see https://www.w3.org/TR/activitypub/#inbox
*
* @var string
* | null
* @var string|null
*/
protected $inbox;

Expand All @@ -77,8 +76,7 @@ class Actor extends Base_Object {
*
* @see https://www.w3.org/TR/activitypub/#outbox
*
* @var string
* | null
* @var string|null
*/
protected $outbox;

Expand Down
Loading

0 comments on commit 4e43887

Please sign in to comment.