Skip to content

Commit

Permalink
allow overiding conditional logic keys when migrating rules
Browse files Browse the repository at this point in the history
  • Loading branch information
picocodes committed Mar 25, 2024
1 parent 64a350b commit 3e51fd7
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
1 change: 1 addition & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ jobs:
- name: Setup Environment Variables
run: |
echo "export PATH=$HOME/.composer/vendor/bin:$PATH" >> $HOME/.bashrc
echo "export WP_TESTS_PHPUNIT_POLYFILLS_PATH=$HOME/.composer/vendor/yoast/phpunit-polyfills" >> $HOME/.bashrc
source $HOME/.bashrc
- name: Install Dependencies
Expand Down
6 changes: 5 additions & 1 deletion src/DB/Automation_Rule.php
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ public function get_conditional_logic() {
*
* @param array $rules The rules.
*/
public function add_conditional_logic_rules( $rules, $delete_settings = array() ) {
public function add_conditional_logic_rules( $rules, $delete_settings = array(), $overwrite = array() ) {
$conditional_logic = array_merge( noptin_get_default_conditional_logic(), $this->get_conditional_logic() );
$existing_rules = $conditional_logic['enabled'] ? $conditional_logic['rules'] : array();

Expand All @@ -211,6 +211,10 @@ public function add_conditional_logic_rules( $rules, $delete_settings = array()
}
}

if ( is_array( $overwrite ) ) {
$conditional_logic = array_merge( $conditional_logic, $overwrite );
}

$new_settings['conditional_logic'] = $conditional_logic;
$this->set_trigger_settings( $new_settings );
}
Expand Down
4 changes: 2 additions & 2 deletions vendor/composer/installed.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
'name' => 'hizzle-co/noptin',
'pretty_version' => 'dev-master',
'version' => 'dev-master',
'reference' => '66d41cdea77a435076f0858bada03467853938b4',
'reference' => '64a350ba0152326612503eeb747be3d9f9ad07a3',
'type' => 'project',
'install_path' => __DIR__ . '/../../',
'aliases' => array(),
Expand All @@ -13,7 +13,7 @@
'hizzle-co/noptin' => array(
'pretty_version' => 'dev-master',
'version' => 'dev-master',
'reference' => '66d41cdea77a435076f0858bada03467853938b4',
'reference' => '64a350ba0152326612503eeb747be3d9f9ad07a3',
'type' => 'project',
'install_path' => __DIR__ . '/../../',
'aliases' => array(),
Expand Down

0 comments on commit 3e51fd7

Please sign in to comment.