Skip to content

Commit

Permalink
fix: prevent updating content of a sent campaign
Browse files Browse the repository at this point in the history
  • Loading branch information
adekbadek committed Apr 24, 2020
1 parent 7afa2c1 commit cce029e
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions includes/class-newspack-newsletters.php
Original file line number Diff line number Diff line change
Expand Up @@ -888,6 +888,11 @@ public static function sync_with_mailchimp( $post ) {
update_post_meta( $post->ID, 'mc_campaign_id', $mc_campaign_id );
}

// Prevent updating content of a sent campaign.
if ( ! in_array( $campaign_result['status'], [ 'sent', 'sending' ] ) ) {
return;
}

$renderer = new Newspack_Newsletters_Renderer();
$content_payload = [
'html' => $renderer->render_html_email( $post ),
Expand Down

0 comments on commit cce029e

Please sign in to comment.