Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(ras-acc): revert RAS-ACC release #3612

Draft
wants to merge 1 commit into
base: release
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .github/workflows/changelog.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ on:

jobs:
labeler:
if: github.event.pull_request.merged == true && github.event.pull_request.base.ref == 'trunk' && github.event.pull_request.user.login != 'dependabot[bot]'
if: github.event.pull_request.merged == true && github.event.pull_request.base.ref == 'trunk'
permissions:
contents: read
pull-requests: write
Expand All @@ -14,7 +14,7 @@ jobs:
- uses: actions/labeler@v5

comment_pr:
if: github.event.pull_request.merged == true && github.event.pull_request.base.ref == 'trunk' && github.event.pull_request.user.login != 'dependabot[bot]'
if: github.event.pull_request.merged == true && github.event.pull_request.base.ref == 'trunk'
permissions:
contents: read
pull-requests: write
Expand All @@ -25,12 +25,12 @@ jobs:
uses: thollander/actions-comment-pull-request@v3
with:
message: |
Hey @${{ github.event.pull_request.user.login }}, good job getting this PR merged! :tada:
Hey @${{ github.event.pull_request.assignee.login }}, good job getting this PR merged! :tada:

Now, the `needs-changelog` label has been added to it.

Please check if this PR needs to be included in the "Upcoming Changes" and "Release Notes" doc. If it doesn't, simply remove the label.

If it does, please add an entry to our shared document, with screenshots and testing instructions if applicable, then remove the label.
If it does, please add an entry to it to our shared document, with screenshots and testing instructions if applicable, then remove the label.

Thank you! :heart:
8 changes: 1 addition & 7 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -463,6 +463,7 @@ ress/* packages

# [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 @@ -569,13 +570,6 @@ ress/* packages

* **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
2 changes: 1 addition & 1 deletion includes/class-blocks.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public static function enqueue_block_editor_assets() {
'has_reader_activation' => Reader_Activation::is_enabled(),
'newsletters_url' => Wizards::get_wizard( 'engagement' )->newsletters_settings_url(),
'has_google_oauth' => Google_OAuth::is_oauth_configured(),
'google_logo_svg' => \Newspack\Newspack_UI_Icons::get_svg( 'google' ),
'google_logo_svg' => file_get_contents( dirname( NEWSPACK_PLUGIN_FILE ) . '/src/blocks/reader-registration/icons/google.svg' ),
'reader_activation_terms' => Reader_Activation::get_setting( 'terms_text' ),
'reader_activation_url' => Reader_Activation::get_setting( 'terms_url' ),
'has_recaptcha' => Recaptcha::can_use_captcha(),
Expand Down
68 changes: 15 additions & 53 deletions includes/class-donations.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,24 +64,18 @@ class Donations {
* @codeCoverageIgnore
*/
public static function init() {
self::$donation_product_name = __( 'Donate', 'newspack-plugin' );

// Process donation request.
add_action( 'wp_ajax_modal_checkout_request', [ __CLASS__, 'process_donation_request' ] );
add_action( 'wp_ajax_nopriv_modal_checkout_request', [ __CLASS__, 'process_donation_request' ] );
add_action( 'wp_loaded', [ __CLASS__, 'process_donation_request' ], 99 );

add_action( 'woocommerce_checkout_update_order_meta', [ __CLASS__, 'woocommerce_checkout_update_order_meta' ] );
add_filter( 'woocommerce_billing_fields', [ __CLASS__, 'woocommerce_billing_fields' ] );
add_filter( 'pre_option_woocommerce_enable_guest_checkout', [ __CLASS__, 'disable_guest_checkout' ] );
add_action( 'woocommerce_check_cart_items', [ __CLASS__, 'handle_cart' ] );
add_filter( 'amp_skip_post', [ __CLASS__, 'should_skip_amp' ], 10, 2 );
add_filter( 'newspack_blocks_donate_billing_fields_keys', [ __CLASS__, 'get_billing_fields' ] );
add_action( 'woocommerce_checkout_create_order_line_item', [ __CLASS__, 'checkout_create_order_line_item' ], 10, 4 );
add_filter( 'woocommerce_coupons_enabled', [ __CLASS__, 'disable_coupons' ] );
add_filter( 'wcs_place_subscription_order_text', [ __CLASS__, 'order_button_text' ], 9 );
add_filter( 'woocommerce_order_button_text', [ __CLASS__, 'order_button_text' ], 9 );
add_filter( 'option_woocommerce_subscriptions_order_button_text', [ __CLASS__, 'order_button_text' ], 9 );
self::$donation_product_name = __( 'Donate', 'newspack' );
if ( ! is_admin() ) {
add_action( 'wp_loaded', [ __CLASS__, 'process_donation_form' ], 99 );
add_action( 'woocommerce_checkout_update_order_meta', [ __CLASS__, 'woocommerce_checkout_update_order_meta' ] );
add_filter( 'woocommerce_billing_fields', [ __CLASS__, 'woocommerce_billing_fields' ] );
add_filter( 'pre_option_woocommerce_enable_guest_checkout', [ __CLASS__, 'disable_guest_checkout' ] );
add_action( 'woocommerce_check_cart_items', [ __CLASS__, 'handle_cart' ] );
add_filter( 'amp_skip_post', [ __CLASS__, 'should_skip_amp' ], 10, 2 );
add_filter( 'newspack_blocks_donate_billing_fields_keys', [ __CLASS__, 'get_billing_fields' ] );
add_action( 'woocommerce_checkout_create_order_line_item', [ __CLASS__, 'checkout_create_order_line_item' ], 10, 4 );
add_action( 'woocommerce_coupons_enabled', [ __CLASS__, 'disable_coupons' ] );
}
}

/**
Expand Down Expand Up @@ -653,11 +647,7 @@ public static function is_platform_other() {
/**
* Handle submission of the donation form.
*/
public static function process_donation_request() {
if ( is_admin() && ! defined( 'DOING_AJAX' ) ) {
return;
}

public static function process_donation_form() {
$is_wc = self::is_platform_wc();

$donation_form_submitted = filter_input( INPUT_GET, 'newspack_donate', FILTER_SANITIZE_NUMBER_INT );
Expand Down Expand Up @@ -747,11 +737,6 @@ function ( $item ) {
[],
$cart_item_data
);

// Set checkout registration flag if user is not logged in.
if ( ! is_user_logged_in() && class_exists( '\Newspack_Blocks\Modal_Checkout' ) ) {
\Newspack_Blocks\Modal_Checkout::set_checkout_registration_flag();
}
}

$query_args = [];
Expand Down Expand Up @@ -786,16 +771,8 @@ function ( $item ) {
);

// Redirect to checkout.
$checkout_url = apply_filters( 'newspack_donation_checkout_url', $checkout_url, $donation_value, $donation_frequency );

if ( defined( 'DOING_AJAX' ) ) {
echo wp_json_encode( [ 'url' => $checkout_url ] );
exit;
} else {
// Redirect to checkout.
\wp_safe_redirect( $checkout_url );
exit;
}
\wp_safe_redirect( apply_filters( 'newspack_donation_checkout_url', $checkout_url, $donation_value, $donation_frequency ) );
exit;
}

/**
Expand Down Expand Up @@ -1108,9 +1085,6 @@ public static function update_billing_fields( $billing_fields ) {
* @return bool
*/
public static function disable_coupons( $enabled ) {
if ( is_admin() ) {
return $enabled;
}
$cart = WC()->cart;
if ( ! $cart ) {
return $enabled;
Expand All @@ -1120,17 +1094,5 @@ public static function disable_coupons( $enabled ) {
}
return false;
}

/**
* Set the "Place order" button text.
*
* @param string $text The button text.
*/
public static function order_button_text( $text ) {
if ( self::is_donation_cart() ) {
return __( 'Donate now', 'newspack-plugin' );
}
return $text;
}
}
Donations::init();
Loading