Skip to content

Commit

Permalink
Merge branch 'fix/random-tag-creation' of https://github.com/Automatt…
Browse files Browse the repository at this point in the history
…ic/wordpress-activitypub into fix/random-tag-creation
  • Loading branch information
pfefferle committed Jan 29, 2025
2 parents 299c613 + e5a75d3 commit aca80c1
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Fixed

* Handle deletes from remote servers that leave behind an accessible Tombstone object.
* No longer parses tags for post types that don't support Activitypub.

## [4.7.3] - 2025-01-21

Expand Down
1 change: 1 addition & 0 deletions readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ For reasons of data protection, it is not possible to see the followers of other

* Changed: Improved content negotiation and AUTHORIZED_FETCH support for third-party plugins
* Fixed: Handle deletes from remote servers that leave behind an accessible Tombstone object.
* Fixed: No longer parses tags for post types that don't support Activitypub.

= 4.7.3 =

Expand Down
23 changes: 22 additions & 1 deletion tests/includes/class-test-hashtag.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@

namespace Activitypub\Tests;

use Activitypub\Collection\Followers;

/**
* Test class for Activitypub Hashtag.
*
Expand Down Expand Up @@ -89,7 +91,7 @@ public function the_content_provider() {
* @param string $message The error message.
*/
public function test_hashtag_conversion( $content, $excerpt, $expected_tags, $message ) {
$post_id = $this->factory->post->create(
$post_id = self::factory()->post->create(
array(
'post_content' => $content,
'post_excerpt' => $excerpt,
Expand All @@ -104,6 +106,25 @@ public function test_hashtag_conversion( $content, $excerpt, $expected_tags, $me
}
}

/**
* Test no hashtags for unsupported post types.
*
* @covers ::insert_post
*/
public function test_no_hashtags_for_unsupported_post_types() {
$post_id = self::factory()->post->create(
array(
'post_content' => 'Testing #php and #programming',
'post_type' => Followers::POST_TYPE,
)
);

\Activitypub\Hashtag::insert_post( $post_id, get_post( $post_id ) );
$tags = wp_get_post_tags( $post_id, array( 'fields' => 'names' ) );

$this->assertEmpty( $tags, 'Should not add hashtags to unsupported post types' );
}

/**
* Data provider for hashtag tests.
*
Expand Down

0 comments on commit aca80c1

Please sign in to comment.