Skip to content

Commit

Permalink
Resolving merge conflict
Browse files Browse the repository at this point in the history
  • Loading branch information
renatonascalves committed Oct 14, 2024
2 parents 2028130 + bc3e50e commit 24c23d6
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 3 deletions.
9 changes: 9 additions & 0 deletions admin/apple-actions/index/class-push.php
Original file line number Diff line number Diff line change
Expand Up @@ -472,6 +472,15 @@ private function push( $user_id = null, $display_notices = true ): void {
}

if ( $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|null $original_error_message The original error message, if available.
* @param string $error_message The error message to be displayed.
*/
do_action( 'apple_news_after_push_failure', $this->id, $original_error_message, $error_message );

throw new Action_Exception( esc_html( $error_message ) );
}
}
Expand Down
8 changes: 8 additions & 0 deletions admin/settings/class-admin-apple-settings-section.php
Original file line number Diff line number Diff line change
Expand Up @@ -643,5 +643,13 @@ public function save_settings() {

// Save to options.
update_option( self::$section_option_name, $settings, 'no' );

/**
* Update the cached settings with new one after an update.
*
* The `self::get_value` method uses this cached data. By resetting it, we ensure
* that the new value is used after an update instead of the old value.
*/
self::$loaded_settings = $settings;
}
}
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 24c23d6

Please sign in to comment.