Skip to content

Commit

Permalink
Frontend scripts: print options later (#1131)
Browse files Browse the repository at this point in the history
* Frontend scripts: print options later

* changelog

* print frontend scripts in footer

* changelog ii
  • Loading branch information
mattwiebe authored Jan 10, 2025
1 parent dfc23ad commit 8100153
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
* Fetching replies from the same instance for Enable Mastodon Apps
* Image captions not being included in the ActivityPub representation when the image is attached to the post

### Changed
* Print `_activityPubOptions` in the `wp_footer` action on the frontend.

## [4.6.0] - 2024-12-20

### Added
Expand Down
4 changes: 2 additions & 2 deletions includes/class-blocks.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public static function init() {
// This is already being called on the init hook, so just add it.
self::register_blocks();

\add_action( 'wp_enqueue_scripts', array( self::class, 'inject_activitypub_options' ) );
\add_action( 'wp_footer', array( self::class, 'inject_activitypub_options' ) );
\add_action( 'admin_print_scripts', array( self::class, 'inject_activitypub_options' ) );
\add_action( 'load-post-new.php', array( self::class, 'handle_in_reply_to_get_param' ) );
// Add editor plugin.
Expand Down Expand Up @@ -119,7 +119,7 @@ public static function inject_activitypub_options() {
);

printf(
'<script>var _activityPubOptions = %s;</script>',
"\n<script>var _activityPubOptions = %s;</script>",
wp_json_encode( $data )
);
}
Expand Down
1 change: 1 addition & 0 deletions readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ For reasons of data protection, it is not possible to see the followers of other
* Fixed: @-mentions in federated comments being displayed with a line break
* Fixed: Fetching replies from the same instance for Enable Mastodon Apps
* Fixed: Image captions not being included in the ActivityPub representation when the image is attached to the post
* Changed: Print `_activityPubOptions` in the `wp_footer` action on the frontend.

= 4.6.0 =

Expand Down

0 comments on commit 8100153

Please sign in to comment.