From 8b1367a16d45242b1cbf19cb52881994255c4957 Mon Sep 17 00:00:00 2001 From: Matthias Pfefferle Date: Sat, 13 Apr 2019 20:07:56 +0200 Subject: [PATCH] fixes JSON representation of posts https://merveilles.town/@xuv/101907542498716956 --- README.md | 8 ++++++-- activitypub.php | 2 +- languages/activitypub.pot | 6 +++--- readme.txt | 8 ++++++-- templates/json-post.php | 5 ++--- 5 files changed, 18 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index dee46f4..24e1048 100644 --- a/README.md +++ b/README.md @@ -3,8 +3,8 @@ **Donate link:** https://notiz.blog/donate/ **Tags:** OStatus, fediverse, activitypub, activitystream **Requires at least:** 4.7 -**Tested up to:** 5.1.1 -**Stable tag:** 0.7.1 +**Tested up to:** 5.2 +**Stable tag:** 0.7.2 **Requires PHP:** 5.6 **License:** MIT **License URI:** http://opensource.org/licenses/MIT @@ -62,6 +62,10 @@ To implement: Project maintained on github at [pfefferle/wordpress-activitypub](https://github.com/pfefferle/wordpress-activitypub). +### 0.7.2 ### + +* fixes JSON representation of posts https://merveilles.town/@xuv/101907542498716956 + ### 0.7.1 ### * fixed inbox problems with pleroma diff --git a/activitypub.php b/activitypub.php index 0871d7c..9819617 100644 --- a/activitypub.php +++ b/activitypub.php @@ -3,7 +3,7 @@ * Plugin Name: ActivityPub * Plugin URI: https://github.com/pfefferle/wordpress-activitypub/ * Description: The ActivityPub protocol is a decentralized social networking protocol based upon the ActivityStreams 2.0 data format. - * Version: 0.7.1 + * Version: 0.7.2 * Author: Matthias Pfefferle * Author URI: https://notiz.blog/ * License: MIT diff --git a/languages/activitypub.pot b/languages/activitypub.pot index d50c3ac..9b591b6 100644 --- a/languages/activitypub.pot +++ b/languages/activitypub.pot @@ -2,9 +2,9 @@ # This file is distributed under the MIT. msgid "" msgstr "" -"Project-Id-Version: ActivityPub 0.7.1\n" +"Project-Id-Version: ActivityPub 0.7.2\n" "Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/activitypub\n" -"POT-Creation-Date: 2019-03-14 22:10:06+00:00\n" +"POT-Creation-Date: 2019-04-13 18:07:11+00:00\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=utf-8\n" "Content-Transfer-Encoding: 8bit\n" @@ -106,7 +106,7 @@ msgstr "" #: includes/rest/class-followers.php:46 includes/rest/class-followers.php:49 #: includes/rest/class-following.php:46 includes/rest/class-following.php:49 -#: includes/rest/class-outbox.php:47 includes/rest/class-outbox.php:50 +#: includes/rest/class-outbox.php:45 includes/rest/class-outbox.php:48 #: includes/rest/class-webfinger.php:61 msgid "User not found" msgstr "" diff --git a/readme.txt b/readme.txt index 8815124..3192646 100644 --- a/readme.txt +++ b/readme.txt @@ -3,8 +3,8 @@ Contributors: pfefferle Donate link: https://notiz.blog/donate/ Tags: OStatus, fediverse, activitypub, activitystream Requires at least: 4.7 -Tested up to: 5.1.1 -Stable tag: 0.7.1 +Tested up to: 5.2 +Stable tag: 0.7.2 Requires PHP: 5.6 License: MIT License URI: http://opensource.org/licenses/MIT @@ -62,6 +62,10 @@ To implement: Project maintained on github at [pfefferle/wordpress-activitypub](https://github.com/pfefferle/wordpress-activitypub). += 0.7.2 = + +* fixes JSON representation of posts https://merveilles.town/@xuv/101907542498716956 + = 0.7.1 = * fixed inbox problems with pleroma diff --git a/templates/json-post.php b/templates/json-post.php index f6b5ef4..8ab028e 100644 --- a/templates/json-post.php +++ b/templates/json-post.php @@ -2,11 +2,10 @@ $post = get_post(); $activitypub_post = new \Activitypub\Post( $post ); -$activitypub_activity = new \Activitypub\Activity( 'Create', \Activitypub\Activity::TYPE_FULL ); -$activitypub_activity->from_post( $activitypub_post->to_array() ); +$json = array_merge( array( '@context' => \Activitypub\get_context() ), $activitypub_post->to_array() ); // filter output -$json = apply_filters( 'activitypub_json_post_array', $activitypub_activity->to_array() ); +$json = apply_filters( 'activitypub_json_post_array', $json ); /* * Action triggerd prior to the ActivityPub profile being created and sent to the client