Skip to content

Commit

Permalink
fix automation rule email data reset
Browse files Browse the repository at this point in the history
  • Loading branch information
picocodes committed Feb 8, 2024
1 parent 82366f9 commit ddff728
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 17 deletions.
2 changes: 1 addition & 1 deletion build/Emails/assets/js/email-editor.asset.php
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<?php return array('dependencies' => array('lodash', 'react', 'wp-api-fetch', 'wp-autop', 'wp-blob', 'wp-block-editor', 'wp-blocks', 'wp-commands', 'wp-components', 'wp-compose', 'wp-core-data', 'wp-data', 'wp-data-controls', 'wp-date', 'wp-deprecated', 'wp-dom', 'wp-editor', 'wp-element', 'wp-format-library', 'wp-hooks', 'wp-html-entities', 'wp-i18n', 'wp-keyboard-shortcuts', 'wp-keycodes', 'wp-media-utils', 'wp-notices', 'wp-plugins', 'wp-preferences', 'wp-primitives', 'wp-rich-text', 'wp-url'), 'version' => '2209755333bd4256b0bb');
<?php return array('dependencies' => array('lodash', 'react', 'wp-api-fetch', 'wp-autop', 'wp-blob', 'wp-block-editor', 'wp-blocks', 'wp-commands', 'wp-components', 'wp-compose', 'wp-core-data', 'wp-data', 'wp-data-controls', 'wp-date', 'wp-deprecated', 'wp-dom', 'wp-editor', 'wp-element', 'wp-format-library', 'wp-hooks', 'wp-html-entities', 'wp-i18n', 'wp-keyboard-shortcuts', 'wp-keycodes', 'wp-media-utils', 'wp-notices', 'wp-plugins', 'wp-preferences', 'wp-primitives', 'wp-rich-text', 'wp-url'), 'version' => '0172c29bf3a267e78974');
30 changes: 15 additions & 15 deletions build/Emails/assets/js/email-editor.js

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -385,10 +385,16 @@ public static function sync_campaign_to_rule( $campaign, $trigger_settings = nul

if ( $is_new ) {
$campaign_data = get_post_meta( $campaign->id, 'campaign_data', true );

// If data is stdClass, convert it to an array.
if ( is_object( $campaign_data ) ) {
$campaign_data = (array) $campaign_data;
}

$campaign_data = ! is_array( $campaign_data ) ? array() : $campaign_data;

$campaign_data['automation_rule'] = $rule->get_id();
update_post_meta( $campaign->id, 'campaign_data', $campaign_data );
update_post_meta( $campaign->id, 'campaign_data', (object) $campaign_data );
}

return $rule->get_data();
Expand Down

0 comments on commit ddff728

Please sign in to comment.