Skip to content

Commit

Permalink
Adding CR suggestions.
Browse files Browse the repository at this point in the history
  • Loading branch information
renatonascalves committed Sep 12, 2024
1 parent 5f9a547 commit 280b298
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion admin/apple-actions/class-api-action.php
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ protected function is_api_configuration_valid() {
*
* @param int $post_id The post ID to reset.
*/
protected function reset_meta( $post_id ): void {
protected function delete_post_meta( $post_id ): void {
delete_post_meta( $post_id, 'apple_news_api_id' );
delete_post_meta( $post_id, 'apple_news_api_revision' );
delete_post_meta( $post_id, 'apple_news_api_created_at' );
Expand Down
2 changes: 1 addition & 1 deletion admin/apple-actions/index/class-delete.php
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ private function delete() {
$this->get_api()->delete_article( $remote_id );

// Delete the API references and mark as deleted.
$this->reset_meta( $this->id );
$this->delete_post_meta( $this->id );
update_post_meta( $this->id, 'apple_news_api_deleted', time() );

// Clear the cache for post status.
Expand Down
8 changes: 4 additions & 4 deletions admin/apple-actions/index/class-get.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,11 @@ public function perform() {
$article = $this->get_api()->get_article( $apple_id );
} catch ( \Apple_Push_API\Request\Request_Exception $e ) {
$article = $e->getMessage();
}

// Reset the API postmeta if the article is not present in Apple News.
if ( is_string( $article ) && str_contains( $article, 'NOT_FOUND (keyPath articleId)' ) ) {
$this->reset_meta( $this->id );
// Reset the API postmeta if the article is deleted in Apple News.
if ( is_string( $article ) && str_contains( $article, 'NOT_FOUND (keyPath articleId)' ) ) {
$this->delete_post_meta( $this->id );
}
}

if ( empty( $article->data ) ) {
Expand Down

0 comments on commit 280b298

Please sign in to comment.