Skip to content

Commit

Permalink
fix: merge trunk into epic/ras-acc
Browse files Browse the repository at this point in the history
  • Loading branch information
laurelfulford committed Jul 11, 2024
2 parents d8d457e + 4462adb commit 40c7800
Show file tree
Hide file tree
Showing 9 changed files with 1,118 additions and 69 deletions.
24 changes: 18 additions & 6 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,21 +1,26 @@
## [4.4.1](https://github.com/Automattic/newspack-plugin/compare/v4.4.0...v4.4.1) (2024-07-08)
# [4.5.0](https://github.com/Automattic/newspack-plugin/compare/v4.4.2...v4.5.0) (2024-07-11)


### Bug Fixes
### Features

* update text domain ([#3222](https://github.com/Automattic/newspack-plugin/issues/3222)) ([ac9da56](https://github.com/Automattic/newspack-plugin/commit/ac9da56d80d1362cc8cc6c5ab0264ce55c2e2ed4))
* remove 'Patterns' link from Appearance menu ([#3236](https://github.com/Automattic/newspack-plugin/issues/3236)) ([b1150f5](https://github.com/Automattic/newspack-plugin/commit/b1150f54eee24b07ecc9d083b64b787cefa8e414))

## [4.4.2](https://github.com/Automattic/newspack-plugin/compare/v4.4.1...v4.4.2) (2024-07-10)

## [4.3.4](https://github.com/Automattic/newspack-plugin/compare/v4.3.3...v4.3.4) (2024-06-27)

### Bug Fixes

* add credits meta attributes check and dependencies to image block effect hook ([#3230](https://github.com/Automattic/newspack-plugin/issues/3230)) ([b257d2b](https://github.com/Automattic/newspack-plugin/commit/b257d2bfcd6127908c015963c467c596a7cbc89b))

## [4.4.1](https://github.com/Automattic/newspack-plugin/compare/v4.4.0...v4.4.1) (2024-07-08)


### Bug Fixes

* variable name > constant ([#3203](https://github.com/Automattic/newspack-plugin/issues/3203)) ([46c5651](https://github.com/Automattic/newspack-plugin/commit/46c5651cf48e88abef3b8f3855b8fd3f5860c2a3))
* update text domain ([#3222](https://github.com/Automattic/newspack-plugin/issues/3222)) ([ac9da56](https://github.com/Automattic/newspack-plugin/commit/ac9da56d80d1362cc8cc6c5ab0264ce55c2e2ed4))

# [4.4.0](https://github.com/Automattic/newspack-plugin/compare/v4.3.4...v4.4.0) (2024-07-01)


### Bug Fixes

* add modified check before updating donation product ([#3183](https://github.com/Automattic/newspack-plugin/issues/3183)) ([208c55e](https://github.com/Automattic/newspack-plugin/commit/208c55e21ac8f6a4b6736f89c25cf12994f2cbaf))
Expand Down Expand Up @@ -122,6 +127,13 @@

* **ia:** back to `trunk` ([69b2ba0](https://github.com/Automattic/newspack-plugin/commit/69b2ba09a222e7c1b84b9cba0b97c36881cda63f))

## [4.3.4](https://github.com/Automattic/newspack-plugin/compare/v4.3.3...v4.3.4) (2024-06-27)

### Bug Fixes

* variable name > constant ([#3203](https://github.com/Automattic/newspack-plugin/issues/3203)) ([46c5651](https://github.com/Automattic/newspack-plugin/commit/46c5651cf48e88abef3b8f3855b8fd3f5860c2a3))


## [4.3.3](https://github.com/Automattic/newspack-plugin/compare/v4.3.2...v4.3.3) (2024-06-24)


Expand Down
16 changes: 14 additions & 2 deletions assets/blocks/core-image/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,21 @@ const AttributesLoader = ( { setAttributes, attributes }: ImageBlockTypes.Attrib
// Meta added, proceed
if ( Object.keys( meta ).length ) {
const { _media_credit, _media_credit_url, _navis_media_credit_org } = meta;
setAttributes( { meta: { _media_credit, _media_credit_url, _navis_media_credit_org } } );
// Only trigger if our meta has updated.
if (
_media_credit !== attributes?.meta?._media_credit ||
_media_credit_url !== attributes?.meta?._media_credit_url ||
_navis_media_credit_org !== attributes?.meta?._navis_media_credit_org
) {
setAttributes( { meta: { _media_credit, _media_credit_url, _navis_media_credit_org } } );
}
}
}, [ Object.keys( meta ).length ] );
}, [
meta,
attributes?.meta?._media_credit,
attributes?.meta?._media_credit_url,
attributes?.meta?._navis_media_credit_org,
] );

return <></>;
};
Expand Down
2 changes: 1 addition & 1 deletion assets/blocks/reader-registration/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,6 @@ function render_block( $attrs, $content ) {
<?php if ( Recaptcha::can_use_captcha( 'v2' ) ) : ?>
<?php Recaptcha::render_recaptcha_v2_container(); ?>
<?php endif; ?>
<?php Reader_Activation::render_third_party_auth(); ?>
<div class="newspack-registration__inputs">
<input
<?php
Expand All @@ -286,6 +285,7 @@ function render_block( $attrs, $content ) {
<span class="submit"><?php echo \esc_html( $attrs['label'] ); ?></span>
</button>
</div>
<?php Reader_Activation::render_third_party_auth(); ?>
<div class="newspack-registration__response <?php echo ( empty( $message ) ) ? 'newspack-registration--hidden' : null; ?>">
<?php if ( ! empty( $message ) ) : ?>
<p><?php echo \esc_html( $message ); ?></p>
Expand Down
31 changes: 31 additions & 0 deletions assets/reader-activation/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,8 @@ export function hasAuthLink() {
return !! ( reader?.email && otpHash );
}

const authStrategies = [ 'pwd', 'link' ];

/**
* Start the authentication modal with an optional custom callback.
*
Expand Down Expand Up @@ -298,6 +300,33 @@ export function authenticateOTP( code ) {
} );
}

/**
* Set the reader preferred authentication strategy.
*
* @param {string} strategy Authentication strategy.
*
* @return {string} Reader preferred authentication strategy.
*/
export function setAuthStrategy( strategy ) {
if ( ! authStrategies.includes( strategy ) ) {
throw new Error( 'Invalid authentication strategy' );
}
setCookie( 'np_auth_strategy', strategy );
return strategy;
}

/**
* Get the reader preferred authentication strategy.
*
* @return {string} Reader preferred authentication strategy.
*/
export function getAuthStrategy() {
if ( getOTPHash() ) {
return 'otp';
}
return getCookie( 'np_auth_strategy' );
}

/**
* Ensure the client ID cookie is set.
*/
Expand Down Expand Up @@ -393,6 +422,8 @@ const readerActivation = {
clearOTPTimer,
getOTPTimeRemaining,
authenticateOTP,
setAuthStrategy,
getAuthStrategy,
getCaptchaV3Token: window.newspack_grecaptcha
? window.newspack_grecaptcha?.getCaptchaV3Token
: () => new Promise( res => res( '' ) ), // Empty promise.
Expand Down
8 changes: 8 additions & 0 deletions includes/class-patches.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ public static function init() {
add_filter( 'wpseo_enhanced_slack_data', [ __CLASS__, 'use_cap_for_slack_preview' ] );
add_action( 'admin_menu', [ __CLASS__, 'add_patterns_menu_link' ] );
add_action( 'admin_menu', [ __CLASS__, 'add_pattern_categories_menu_link' ] );
add_action( 'admin_menu', [ __CLASS__, 'remove_core_patterns_menu_link' ] );
add_action( 'manage_edit-wp_block_columns', [ __CLASS__, 'add_custom_columns' ] );
add_action( 'manage_edit-wp_block_sortable_columns', [ __CLASS__, 'add_sortable_columns' ] );
add_action( 'manage_wp_block_posts_custom_column', [ __CLASS__, 'custom_column_content' ], 10, 2 );
Expand Down Expand Up @@ -118,6 +119,13 @@ public static function add_pattern_categories_menu_link() {
add_submenu_page( 'edit.php', 'manage_pattern_categories', __( 'Pattern Categories', 'newspack-plugin' ), 'edit_posts', 'edit-tags.php?taxonomy=wp_pattern_category', '', 3 );
}

/**
* Remove the Core Patterns link, which redirects to the Site Editor as of WordPress 6.6.
*/
public static function remove_core_patterns_menu_link() {
remove_submenu_page( 'themes.php', 'site-editor.php?path=/patterns' );
}

/**
* Add a custom column to the patterns list table.
*
Expand Down
2 changes: 1 addition & 1 deletion includes/class-recaptcha.php
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ public static function get_script_url() {
*/
public static function register_scripts() {
// Styles only apply to the visible v2 widgets.
if ( self::can_use_captcha() ) {
if ( self::can_use_captcha( 'v2' ) ) {
\wp_enqueue_style(
self::SCRIPT_HANDLE,
Newspack::plugin_url() . '/dist/other-scripts/recaptcha.css',
Expand Down
4 changes: 2 additions & 2 deletions newspack.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
/**
* Plugin Name: Newspack
* Description: An advanced open-source publishing and revenue-generating platform for news organizations.
* Version: 4.4.1
* Version: 4.5.0
* Author: Automattic
* Author URI: https://newspack.com/
* License: GPL2
Expand All @@ -14,7 +14,7 @@

defined( 'ABSPATH' ) || exit;

define( 'NEWSPACK_PLUGIN_VERSION', '4.4.1' );
define( 'NEWSPACK_PLUGIN_VERSION', '4.5.0' );

// Load language files.
load_plugin_textdomain( 'newspack-plugin', false, dirname( plugin_basename( __FILE__ ) ) . '/languages' );
Expand Down
Loading

0 comments on commit 40c7800

Please sign in to comment.