Skip to content

Commit

Permalink
Merge tag 'v5.7.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
davisshaver committed Nov 12, 2024
2 parents d9e1bd6 + b9fe1b9 commit bc026ba
Show file tree
Hide file tree
Showing 31 changed files with 1,113 additions and 154 deletions.
2 changes: 2 additions & 0 deletions .github/labeler.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
needs-changelog:
- base-branch: ['trunk']
36 changes: 36 additions & 0 deletions .github/workflows/changelog.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: "Pull Request Labeler"
on:
pull_request:
types: [closed]

jobs:
labeler:
if: github.event.pull_request.merged == true && github.event.pull_request.base.ref == 'trunk'
permissions:
contents: read
pull-requests: write
runs-on: ubuntu-latest
steps:
- uses: actions/labeler@v5

comment_pr:
if: github.event.pull_request.merged == true && github.event.pull_request.base.ref == 'trunk'
permissions:
contents: read
pull-requests: write
runs-on: ubuntu-latest
name: Comment about the change log label
steps:
- name: Comment PR
uses: thollander/actions-comment-pull-request@v3
with:
message: |
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 it to our shared document, with screenshots and testing instructions if applicable, then remove the label.
Thank you! :heart:
29 changes: 29 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,32 @@
# [5.7.0](https://github.com/Automattic/newspack-plugin/compare/v5.6.1...v5.7.0) (2024-11-11)


### Bug Fixes

* avoid duplicate info notices in email editors ([#3512](https://github.com/Automattic/newspack-plugin/issues/3512)) ([d38fc1a](https://github.com/Automattic/newspack-plugin/commit/d38fc1aa18f0571b2a48d1ead128347f10dce57b))
* **co-authors-plus:** CLI for migrating from CAP GA ([9a81584](https://github.com/Automattic/newspack-plugin/commit/9a81584e5771ea15d2d9e3e96a9d782ec9936f26))
* command to fix active subs w/ missing next_payment dates ([#3484](https://github.com/Automattic/newspack-plugin/issues/3484)) ([2e05fd4](https://github.com/Automattic/newspack-plugin/commit/2e05fd4a9e82c995be2a4d354112d41326017d38))
* php fatal and warning ([#3502](https://github.com/Automattic/newspack-plugin/issues/3502)) ([e089172](https://github.com/Automattic/newspack-plugin/commit/e089172f75ccf7bd16e641a257ddcf29687c6a9f))
* **site-kit:** update logger cron to hourly interval ([#3485](https://github.com/Automattic/newspack-plugin/issues/3485)) ([e3823e7](https://github.com/Automattic/newspack-plugin/commit/e3823e7b858c356b3e5e4a490e119b94e7f12285))
* **webhooks:** deprecate global endpoint ([#3492](https://github.com/Automattic/newspack-plugin/issues/3492)) ([63e8ab2](https://github.com/Automattic/newspack-plugin/commit/63e8ab22674e001b27e5158afc25c83793aed824))
* **wp-6.7:** update radio control styles ([#3518](https://github.com/Automattic/newspack-plugin/issues/3518)) ([831756e](https://github.com/Automattic/newspack-plugin/commit/831756e23c74357c88b9eb0a8d40007b7835f0cc))


### Features

* add user name to woocommerce data events ([#3473](https://github.com/Automattic/newspack-plugin/issues/3473)) ([5312d30](https://github.com/Automattic/newspack-plugin/commit/5312d30ba56d9f105d2548bc0dd6430b215cf877))
* automatically disable guest authors ([#3345](https://github.com/Automattic/newspack-plugin/issues/3345)) ([d0db6ba](https://github.com/Automattic/newspack-plugin/commit/d0db6ba6500b140c672e544b8ea04c5e92bebfca))
* **connections:** jetpack sso ([#3486](https://github.com/Automattic/newspack-plugin/issues/3486)) ([123408e](https://github.com/Automattic/newspack-plugin/commit/123408e1338491b5561b5e588d663d4184fa226b))
* display list remote name on newsletter wizard ([#3478](https://github.com/Automattic/newspack-plugin/issues/3478)) ([cd0b859](https://github.com/Automattic/newspack-plugin/commit/cd0b859fad407f5de6b840bbe2da8c596a7793a5))
* **site-kit:** add logging when site kit disconnects ([#3472](https://github.com/Automattic/newspack-plugin/issues/3472)) ([62bf98c](https://github.com/Automattic/newspack-plugin/commit/62bf98c16a17c877324e218c877ad7c33265b3bd))

## [5.6.1](https://github.com/Automattic/newspack-plugin/compare/v5.6.0...v5.6.1) (2024-11-07)


### Bug Fixes

* **my-account:** show Orders & Payment Methods for migrated subscribers ([#3504](https://github.com/Automattic/newspack-plugin/issues/3504)) ([0673c24](https://github.com/Automattic/newspack-plugin/commit/0673c24a07f806326b51922946308a2fd84f1d89))

# [5.6.0](https://github.com/Automattic/newspack-plugin/compare/v5.5.2...v5.6.0) (2024-10-28)


Expand Down
37 changes: 37 additions & 0 deletions includes/class-logger.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,4 +76,41 @@ private static function get_pid() {
public static function error( $payload, $header = 'NEWSPACK' ) {
return self::log( $payload, $header, 'error' );
}

/**
* A logger for newspack manager logging.
*
* @param string $code The log code (i.e. newspack_google_login).
* @param string $message The message to log.
* @param array $data The data to log.
* Optional. Additional parameters.
* @type string $user_email The current users email address.
* @type file $file The name of the file to write the local log to.
* @param string $type The type of log. Defaults to 'error'.
* @param string $log_level The Log level.
*/
public static function newspack_log( $code, $message, $data, $type = 'error', $log_level = 2 ) {
$email = '';
if ( isset( $data['user_email'] ) ) {
$email = $data['user_email'];
unset( $data['user_email'] );
}
$file = $code;
if ( isset( $data['file'] ) ) {
$file = $data['file'];
unset( $data['file'] );
}
do_action(
'newspack_log',
$code,
$message,
[
'type' => $type,
'data' => $data,
'user_email' => $email,
'file' => $file,
'log_level' => $log_level,
]
);
}
}
5 changes: 3 additions & 2 deletions includes/class-newspack-image-credits.php
Original file line number Diff line number Diff line change
Expand Up @@ -422,7 +422,8 @@ function( $setting ) use ( $key ) {
return $setting['key'] === $key;
}
);
return reset( array_values( $setting ) );
$setting_values = array_values( $setting );
return reset( $setting_values );
}

return $default_settings;
Expand Down Expand Up @@ -561,7 +562,7 @@ public static function populate_credit( $metadata, $attachment_id, $context ) {
*/
public static function register_meta() {
foreach ( [
static::MEDIA_CREDIT_META,
static::MEDIA_CREDIT_META,
static::MEDIA_CREDIT_URL_META,
static::MEDIA_CREDIT_ORG_META,
static::MEDIA_CREDIT_CAN_DISTRIBUTE_META,
Expand Down
1 change: 1 addition & 0 deletions includes/class-newspack.php
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,7 @@ private function includes() {
include_once NEWSPACK_ABSPATH . 'includes/plugins/class-jetpack.php';
include_once NEWSPACK_ABSPATH . 'includes/plugins/class-gravityforms.php';
include_once NEWSPACK_ABSPATH . 'includes/plugins/google-site-kit/class-googlesitekit.php';
include_once NEWSPACK_ABSPATH . 'includes/plugins/google-site-kit/class-googlesitekit-logger.php';
include_once NEWSPACK_ABSPATH . 'includes/plugins/class-mailchimp-for-woocommerce.php';
include_once NEWSPACK_ABSPATH . 'includes/plugins/class-onesignal.php';
include_once NEWSPACK_ABSPATH . 'includes/plugins/class-organic-profile-block.php';
Expand Down
8 changes: 4 additions & 4 deletions includes/cli/class-co-authors-plus.php
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ public function backfill_non_editing_contributor( $args, $assoc_args ) {
$users = get_users(
[
'role__in' => [ 'subscriber', 'customer' ],
'role__not_in' => [ \Newspack\Co_Authors_Plus::CONTRIBUTOR_NO_EDIT_ROLE_NAME, 'administrator', 'editor', 'author', 'contributor' ],
'role__not_in' => [ \Newspack\Guest_Contributor_Role::CONTRIBUTOR_NO_EDIT_ROLE_NAME, 'administrator', 'editor', 'author', 'contributor' ],
'fields' => 'ID',
'number' => -1,
]
Expand All @@ -170,7 +170,7 @@ public function backfill_non_editing_contributor( $args, $assoc_args ) {
if ( count_user_posts( $user_id ) > 0 ) { // phpcs:ignore WordPressVIPMinimum.Functions.RestrictedFunctions.count_user_posts_count_user_posts
if ( self::$live ) {
WP_CLI::line( sprintf( 'Will add the Non-Editing Contributor role to user %d.', $user_id ) );
get_user_by( 'id', $user_id )->add_role( \Newspack\Co_Authors_Plus::CONTRIBUTOR_NO_EDIT_ROLE_NAME );
get_user_by( 'id', $user_id )->add_role( \Newspack\Guest_Contributor_Role::CONTRIBUTOR_NO_EDIT_ROLE_NAME );
} else {
WP_CLI::line( sprintf( 'Would add the Non-Editing Contributor role to user %d.', $user_id ) );
}
Expand Down Expand Up @@ -266,7 +266,7 @@ function( $value ) {
'user_nicename' => isset( $post_meta['cap-user_login'] ) ? $post_meta['cap-user_login'] : '',
'user_url' => isset( $post_meta['cap-website'] ) ? $post_meta['cap-website'] : '',
'user_pass' => wp_generate_password(),
'role' => \Newspack\Co_Authors_Plus::CONTRIBUTOR_NO_EDIT_ROLE_NAME,
'role' => \Newspack\Guest_Contributor_Role::CONTRIBUTOR_NO_EDIT_ROLE_NAME,
'display_name' => isset( $post_meta['cap-display_name'] ) ? $post_meta['cap-display_name'] : '',
'first_name' => isset( $post_meta['cap-first_name'] ) ? $post_meta['cap-first_name'] : '',
'last_name' => isset( $post_meta['cap-last_name'] ) ? $post_meta['cap-last_name'] : '',
Expand Down Expand Up @@ -420,7 +420,7 @@ private static function migrate_linked_guest_authors() {
self::assign_user_meta( $guest_author, $user_id );

// Add the Non-Editing Contributor role.
$linked_user->add_role( \Newspack\Co_Authors_Plus::CONTRIBUTOR_NO_EDIT_ROLE_NAME );
$linked_user->add_role( \Newspack\Guest_Contributor_Role::CONTRIBUTOR_NO_EDIT_ROLE_NAME );
}
}

Expand Down
16 changes: 16 additions & 0 deletions includes/data-events/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,8 @@ For when there's a new donation processed through WooCommerce.
| `is_renewal` | `bool` | If this is a subscription renewal (recurring payment) |
| `subscription_id` | `int` | The related subscription id (if any) |
| `platform_data` | `array` | |
| `user_first_name` | `string` | The Woocommerce customer billing first name |
| `user_last_name` | `string` | The Woocommerce customer billing last name |

### `woocommerce_order_failed`

Expand All @@ -111,6 +113,8 @@ the order is already marked as failed so this hook will not trigger.
| `subscription_id` | `int` | The related subscription id (if any) |
| `popup_id` | `string` | If the donation was triggered by a popup, the popup ID |
| `platform_data` | `array` | |
| `user_first_name` | `string` | The Woocommerce customer billing first name |
| `user_last_name` | `string` | The Woocommerce customer billing last name |

### `donation_new`

Expand All @@ -129,6 +133,8 @@ When there's a new donation.
| `is_renewal` | `bool` | If this is a subscription renewal (recurring payment) |
| `subscription_id` | `int` | The related subscription id (if any) |
| `platform_data` | `array` | |
| `user_first_name` | `string` | |
| `user_last_name` | `string` | |

### `order_completed`

Expand All @@ -146,6 +152,8 @@ When any WooCommerce order is completed with a successful payment.
| `is_renewal` | `bool` | If this is a subscription renewal (recurring payment) |
| `subscription_id` | `int` | The related subscription id (if any) |
| `platform_data` | `array` | |
| `user_first_name` | `string` | |
| `user_last_name` | `string` | |

### `donation_subscription_new`

Expand All @@ -162,6 +170,8 @@ When there's a new WooCommerce Subscription. This action does not replace the `d
| `platform` | `string` | |
| `referer` | `string` | |
| `popup_id` | `string` | If the donation was triggered by a popup, the popup ID |
| `user_first_name` | `string` | |
| `user_last_name` | `string` | |

### `donation_subscription_cancelled`

Expand All @@ -176,6 +186,8 @@ When a WooCommerce Subscription is cancelled.
| `currency` | `string` |
| `recurrence` | `string` |
| `platform` | `string` |
| `user_first_name` | `string` |
| `user_last_name` | `string` |

### `donation_subscription_changed`

Expand All @@ -192,6 +204,8 @@ When a WooCommerce Subscription status changes.
| `currency` | `string` |
| `recurrence` | `string` |
| `platform` | `string` |
| `user_first_name` | `string` |
| `user_last_name` | `string` |

### `product_subscription_changed`

Expand All @@ -207,6 +221,8 @@ When a non-donation subscription status changes.
| `recurrence` | `string` |
| `status_before` | `string` |
| `status_after` | `string` |
| `user_first_name` | `string` |
| `user_last_name` | `string` |

## Membership Actions

Expand Down
17 changes: 6 additions & 11 deletions includes/data-events/class-api.php
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ public static function permission_callback() {
if ( ! current_user_can( 'manage_options' ) ) {
return new \WP_Error(
'newspack_rest_forbidden',
esc_html__( 'You cannot use this resource.', 'newspack' ),
esc_html__( 'You cannot use this resource.', 'newspack-plugin' ),
[
'status' => 403,
]
Expand All @@ -129,9 +129,6 @@ private static function get_endpoint_args() {
'sanitize_callback' => 'sanitize_text_field',
],
],
'global' => [
'type' => 'boolean',
],
'disabled' => [
'type' => 'boolean',
],
Expand Down Expand Up @@ -168,7 +165,7 @@ public static function test_url( $request ) {
[
'success' => false,
'code' => false,
'message' => esc_html__( 'Invalid URL.', 'newspack' ),
'message' => esc_html__( 'Invalid URL.', 'newspack-plugin' ),
]
);
}
Expand Down Expand Up @@ -249,16 +246,16 @@ public static function upsert_endpoint( $request ) {
if ( empty( $args['url'] ) || \esc_url_raw( $args['url'], [ 'https' ] ) !== $args['url'] ) {
return new \WP_Error(
'newspack_webhooks_invalid_url',
esc_html__( 'Invalid URL.', 'newspack' ),
esc_html__( 'Invalid URL.', 'newspack-plugin' ),
[
'status' => 400,
]
);
}
if ( ! $args['global'] && empty( $args['actions'] ) ) {
if ( empty( $args['actions'] ) ) {
return new \WP_Error(
'newspack_webhooks_invalid_actions',
esc_html__( 'You must select actions to trigger this endpoint. Set it to global if this endpoint is meant for all actions.', 'newspack' ),
esc_html__( 'You must select actions to trigger this endpoint.', 'newspack-plugin' ),
[
'status' => 400,
]
Expand All @@ -267,15 +264,13 @@ public static function upsert_endpoint( $request ) {
if ( empty( $args['id'] ) ) {
$endpoint = Webhooks::create_endpoint(
$args['url'],
$args['actions'] ?? [],
$args['global']
$args['actions'] ?? []
);
} else {
$endpoint = Webhooks::update_endpoint(
$args['id'],
$args['url'],
$args['actions'] ?? [],
$args['global'],
$args['disabled']
);
}
Expand Down
Loading

0 comments on commit bc026ba

Please sign in to comment.