Skip to content

Commit 26ad897

Browse files
Normalize Hashtag behavior in Mastodon Apps (#407)
* Update class-hashtag.php * Update class-shortcodes.php * fix unit tests * missed two tests --------- Co-authored-by: Matthias Pfefferle <[email protected]>
1 parent c748d12 commit 26ad897

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

includes/class-hashtag.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ public static function replace_with_links( $result ) {
8989

9090
if ( $tag_object ) {
9191
$link = \get_term_link( $tag_object, 'post_tag' );
92-
return \sprintf( '<a rel="tag" class="u-tag u-category" href="%s">#%s</a>', $link, $tag );
92+
return \sprintf( '<a rel="tag" class="hashtag u-tag u-category" href="%s">#%s</a>', $link, $tag );
9393
}
9494

9595
return '#' . $tag;

includes/class-shortcodes.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -359,7 +359,7 @@ public static function hashcats( $atts, $content, $tag ) {
359359

360360
foreach ( $categories as $category ) {
361361
$hash_tags[] = \sprintf(
362-
'<a rel="tag" class="u-tag u-category" href="%s">%s</a>',
362+
'<a rel="tag" class="hashtag u-tag u-category" href="%s">%s</a>',
363363
\esc_url( \get_category_link( $category ) ),
364364
esc_hashtag( $category->name )
365365
);

tests/test-class-activitypub-hashtag.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,12 @@ public function the_content_provider() {
3535
array( 'test', 'test' ),
3636
array( '#test', '#test' ),
3737
array( 'hallo #test test', 'hallo #test test' ),
38-
array( 'hallo #object test', 'hallo <a rel="tag" class="u-tag u-category" href="%s">#object</a> test' ),
39-
array( '#object test', '<a rel="tag" class="u-tag u-category" href="%s">#object</a> test' ),
38+
array( 'hallo #object test', 'hallo <a rel="tag" class="hashtag u-tag u-category" href="%s">#object</a> test' ),
39+
array( '#object test', '<a rel="tag" class="hashtag u-tag u-category" href="%s">#object</a> test' ),
4040
array( 'hallo <a href="http://test.test/#object">test</a> test', 'hallo <a href="http://test.test/#object">test</a> test' ),
4141
array( 'hallo <a href="http://test.test/#object">#test</a> test', 'hallo <a href="http://test.test/#object">#test</a> test' ),
42-
array( '<div>hallo #object test</div>', '<div>hallo <a rel="tag" class="u-tag u-category" href="%s">#object</a> test</div>' ),
43-
array( '<div>hallo #object</div>', '<div>hallo <a rel="tag" class="u-tag u-category" href="%s">#object</a></div>' ),
42+
array( '<div>hallo #object test</div>', '<div>hallo <a rel="tag" class="hashtag u-tag u-category" href="%s">#object</a> test</div>' ),
43+
array( '<div>hallo #object</div>', '<div>hallo <a rel="tag" class="hashtag u-tag u-category" href="%s">#object</a></div>' ),
4444
array( '<div>#object</div>', '<div>#object</div>' ),
4545
array( '<a>#object</a>', '<a>#object</a>' ),
4646
array( '<div style="color: #ccc;">object</a>', '<div style="color: #ccc;">object</a>' ),

0 commit comments

Comments
 (0)