Skip to content

Commit 376e371

Browse files
authored
Merge pull request #267 from pfefferle/fix-publish
fix #266
2 parents d4b1edc + 531bdc1 commit 376e371

File tree

5 files changed

+20
-30
lines changed

5 files changed

+20
-30
lines changed

README.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
**Tags:** OStatus, fediverse, activitypub, activitystream
55
**Requires at least:** 4.7
66
**Tested up to:** 6.1
7-
**Stable tag:** 0.16.0
7+
**Stable tag:** 0.16.1
88
**Requires PHP:** 5.6
99
**License:** MIT
1010
**License URI:** http://opensource.org/licenses/MIT
@@ -88,6 +88,10 @@ Where 'blog' is the path to the subdirectory at which your blog resides.
8888

8989
Project maintained on GitHub at [pfefferle/wordpress-activitypub](https://github.com/pfefferle/wordpress-activitypub).
9090

91+
### 0.16.1 ###
92+
93+
* Fix "update and create, posts appear blank on Mastodon" issue
94+
9195
### 0.16.0 ###
9296

9397
* Add "Outgoing Mentions" ([#213](https://github.com/pfefferle/wordpress-activitypub/pull/213)) props [@akirk](https://github.com/akirk)

activitypub.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* Plugin Name: ActivityPub
44
* Plugin URI: https://github.com/pfefferle/wordpress-activitypub/
55
* Description: The ActivityPub protocol is a decentralized social networking protocol based upon the ActivityStreams 2.0 data format.
6-
* Version: 0.16.0
6+
* Version: 0.16.1
77
* Author: Matthias Pfefferle
88
* Author URI: https://notiz.blog/
99
* License: MIT

includes/model/class-post.php

Lines changed: 5 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -369,11 +369,14 @@ public function get_object_type() {
369369
* @return string the content
370370
*/
371371
public function get_content() {
372+
global $post;
373+
372374
if ( $this->content ) {
373375
return $this->content;
374376
}
375377

376-
$post = $this->post;
378+
// phpcs:ignore WordPress.WP.GlobalVariablesOverride.Prohibited
379+
$post = $this->post;
377380
$content = $this->get_post_content_template();
378381

379382
// Fill in the shortcodes.
@@ -386,7 +389,7 @@ public function get_content() {
386389
$filtered_content = \apply_filters( 'activitypub_the_content', $content, $post );
387390
$decoded_content = \html_entity_decode( $filtered_content, \ENT_QUOTES, 'UTF-8' );
388391

389-
$content = \trim( \preg_replace( '/[\n\r]/', '', $content ) );
392+
$content = \trim( \preg_replace( '/[\n\r\t]/', '', $content ) );
390393

391394
$this->content = $content;
392395

@@ -455,29 +458,4 @@ public static function upgrade_post_content_template() {
455458

456459
return $content;
457460
}
458-
459-
/**
460-
* Adds all tags as hashtags to the post/summary content
461-
*
462-
* @param string $content
463-
* @param WP_Post $post
464-
*
465-
* @return string
466-
*/
467-
public function get_the_mentions() {
468-
$post = $this->post;
469-
$tags = \get_the_tags( $post->ID );
470-
471-
if ( ! $tags ) {
472-
return '';
473-
}
474-
475-
$hash_tags = array();
476-
477-
foreach ( $tags as $tag ) {
478-
$hash_tags[] = \sprintf( '<a rel="tag" class="u-tag u-category" href="%s">#%s</a>', \get_tag_link( $tag ), $tag->slug );
479-
}
480-
481-
return \implode( ' ', $hash_tags );
482-
}
483461
}

readme.txt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Donate link: https://notiz.blog/donate/
44
Tags: OStatus, fediverse, activitypub, activitystream
55
Requires at least: 4.7
66
Tested up to: 6.1
7-
Stable tag: 0.16.0
7+
Stable tag: 0.16.1
88
Requires PHP: 5.6
99
License: MIT
1010
License URI: http://opensource.org/licenses/MIT
@@ -88,6 +88,10 @@ Where 'blog' is the path to the subdirectory at which your blog resides.
8888

8989
Project maintained on GitHub at [pfefferle/wordpress-activitypub](https://github.com/pfefferle/wordpress-activitypub).
9090

91+
= 0.16.1 =
92+
93+
* Fix "update and create, posts appear blank on Mastodon" issue
94+
9195
= 0.16.0 =
9296

9397
* Add "Outgoing Mentions" ([#213](https://github.com/pfefferle/wordpress-activitypub/pull/213)) props [@akirk](https://github.com/akirk)

tests/test-class-activitypub-activity-dispatcher.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ public function test_dispatch_activity() {
3030
$activitypub_post = new \Activitypub\Model\Post( $post );
3131
\Activitypub\Activity_Dispatcher::send_post_activity( $activitypub_post );
3232

33+
$this->assertNotEmpty( $activitypub_post->get_content() );
34+
3335
$this->assertSame( 2, $pre_http_request->get_call_count() );
3436
$all_args = $pre_http_request->get_args();
3537
$first_call_args = array_shift( $all_args );
@@ -69,6 +71,8 @@ function( $mentions ) {
6971
$activitypub_post = new \Activitypub\Model\Post( $post );
7072
\Activitypub\Activity_Dispatcher::send_post_activity( $activitypub_post );
7173

74+
$this->assertNotEmpty( $activitypub_post->get_content() );
75+
7276
$this->assertSame( 1, $pre_http_request->get_call_count() );
7377
$all_args = $pre_http_request->get_args();
7478
$first_call_args = $all_args[0];

0 commit comments

Comments
 (0)