Skip to content

Commit

Permalink
Merge branch 'develop' into fix/issue-1178/reset-loaded-settings-afte…
Browse files Browse the repository at this point in the history
…r-update
  • Loading branch information
renatonascalves authored Oct 14, 2024
2 parents 60a38d9 + 177d587 commit e1cd9c3
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
8 changes: 8 additions & 0 deletions admin/apple-actions/index/class-push.php
Original file line number Diff line number Diff line change
Expand Up @@ -451,6 +451,14 @@ private function push( $user_id = null ): void {
$error_message = __( 'There has been an error with the Apple News API: ', 'apple-news' ) . esc_html( $original_error_message );
}

/**
* Actions to be taken after an article failed to be pushed to Apple News.
*
* @param int $post_id The ID of the post.
* @param string $original_error_message The original error message.
*/
do_action( 'apple_news_after_push_failure', $this->id, $original_error_message );

throw new Action_Exception( esc_html( $error_message ) );
}

Expand Down
7 changes: 4 additions & 3 deletions includes/apple-push-api/request/class-request.php
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,7 @@ private function parse_response( $response, $json = true, $type = 'post', $meta

// Get the admin email.
$admin_email = filter_var( $settings['apple_news_admin_email'], FILTER_VALIDATE_EMAIL );

if ( empty( $admin_email ) ) {
return; // TODO Fix inconsistent return value.
}
Expand All @@ -191,8 +192,8 @@ private function parse_response( $response, $json = true, $type = 'post', $meta
if ( 'yes' === $settings['use_remote_images'] ) {
$body .= esc_html__( 'Use Remote images enabled ', 'apple-news' );
} elseif ( ! empty( $bundles ) ) {
$body .= "\n" . esc_html__( 'Bundled images', 'apple-news' ) . ":\n";
$body .= implode( "\n", $bundles );
$body .= "\n" . esc_html__( 'Bundled images', 'apple-news' ) . ":\n";
$body .= implode( "\n", $bundles );
} else {
$body .= esc_html__( 'No bundled images found.', 'apple-news' );
}
Expand All @@ -210,7 +211,7 @@ private function parse_response( $response, $json = true, $type = 'post', $meta
*
* @since 1.4.4
*
* @param string|array $headers Optional. Additional headers.
* @param string|array $headers Optional. Additional headers.
*/
$headers = apply_filters( 'apple_news_notification_headers', '' );

Expand Down

0 comments on commit e1cd9c3

Please sign in to comment.