diff --git a/composer.json b/composer.json index 527448412..f58dc9cfc 100644 --- a/composer.json +++ b/composer.json @@ -233,6 +233,7 @@ "drupal/twig_field_value": "^2.0", "drupal/twig_tweak": "^2.5", "drupal/ultimate_cron": "^2.0@alpha", + "drupal/update_helper": "^2.0", "drupal/user_registrationpassword": "1.x-dev", "drupal/userpoints": "^1.0@alpha", "drupal/views_data_export": "^1.0", diff --git a/idea.info.yml b/idea.info.yml index c01b90a6e..02fa24ba9 100644 --- a/idea.info.yml +++ b/idea.info.yml @@ -123,6 +123,7 @@ dependencies: - openideal_footer:openideal_footer - openideal_login:openideal_login - openideal_statistics:openideal_statistics + - update_helper:update_helper themes: - adminimal_theme diff --git a/config/install/rules.reaction.create_a_message_after_replying_on_comment.yml b/modules/openideal_comment/config/optional/rules.reaction.create_a_message_after_replying_on_comment.yml similarity index 78% rename from config/install/rules.reaction.create_a_message_after_replying_on_comment.yml rename to modules/openideal_comment/config/optional/rules.reaction.create_a_message_after_replying_on_comment.yml index 0e66e49b9..83b18c49c 100644 --- a/config/install/rules.reaction.create_a_message_after_replying_on_comment.yml +++ b/modules/openideal_comment/config/optional/rules.reaction.create_a_message_after_replying_on_comment.yml @@ -20,8 +20,8 @@ expression: conditions: - id: rules_condition - uuid: 7cd3932b-b234-4283-9b5a-ceb3cdc2ebf7 - weight: 0 + uuid: 7309dabd-c050-4003-97c5-3c06c6517790 + weight: -50 context_values: { } context_mapping: data: comment.pid @@ -29,6 +29,17 @@ expression: provides_mapping: { } condition_id: rules_data_is_empty negate: true + - + id: rules_condition + uuid: 7cd3932b-b234-4283-9b5a-ceb3cdc2ebf7 + weight: -49 + context_values: { } + context_mapping: + data: comment.pid.target_id + context_processors: { } + provides_mapping: { } + condition_id: rules_data_is_empty + negate: true actions: id: rules_action_set uuid: 656824a8-1d2e-4f68-b4d3-de90852222fc diff --git a/config/install/rules.reaction.create_message_after_posting_comment.yml b/modules/openideal_comment/config/optional/rules.reaction.create_message_after_posting_comment.yml similarity index 100% rename from config/install/rules.reaction.create_message_after_posting_comment.yml rename to modules/openideal_comment/config/optional/rules.reaction.create_message_after_posting_comment.yml diff --git a/config/install/rules.reaction.create_message_after_voting_on_comment.yml b/modules/openideal_comment/config/optional/rules.reaction.create_message_after_voting_on_comment.yml similarity index 100% rename from config/install/rules.reaction.create_message_after_voting_on_comment.yml rename to modules/openideal_comment/config/optional/rules.reaction.create_message_after_voting_on_comment.yml diff --git a/config/install/rules.reaction.earn_points_for_posting_a_comment.yml b/modules/openideal_comment/config/optional/rules.reaction.earn_points_for_posting_a_comment.yml similarity index 100% rename from config/install/rules.reaction.earn_points_for_posting_a_comment.yml rename to modules/openideal_comment/config/optional/rules.reaction.earn_points_for_posting_a_comment.yml diff --git a/modules/openideal_comment/config/update/openideal_comment_update_8001.yml b/modules/openideal_comment/config/update/openideal_comment_update_8001.yml new file mode 100644 index 000000000..0f4524150 --- /dev/null +++ b/modules/openideal_comment/config/update/openideal_comment_update_8001.yml @@ -0,0 +1,36 @@ +rules.reaction.create_a_message_after_replying_on_comment: + expected_config: + expression: + conditions: + uuid: 09bb26de-96be-4b7b-8746-80661e94d0d3 + update_actions: + delete: + expression: + conditions: + change: + expression: + conditions: + id: rules_and + uuid: 09bb26de-96be-4b7b-8746-80661e94d0d3 + weight: 0 + conditions: + - id: rules_condition + uuid: 7309dabd-c050-4003-97c5-3c06c6517790 + weight: -50 + context_values: { } + context_mapping: + data: comment.pid + context_processors: { } + provides_mapping: { } + condition_id: rules_data_is_empty + negate: true + - id: rules_condition + uuid: 7cd3932b-b234-4283-9b5a-ceb3cdc2ebf7 + weight: -49 + context_values: { } + context_mapping: + data: comment.pid.target_id + context_processors: { } + provides_mapping: { } + condition_id: rules_data_is_empty + negate: true diff --git a/modules/openideal_comment/openideal_comment.install b/modules/openideal_comment/openideal_comment.install new file mode 100644 index 000000000..ad57c04ca --- /dev/null +++ b/modules/openideal_comment/openideal_comment.install @@ -0,0 +1,23 @@ +moduleExists('update_helper')) { + \Drupal::service('module_installer')->install(['update_helper']); + } + /** @var \Drupal\update_helper\Updater $updateHelper */ + $updateHelper = \Drupal::service('update_helper.updater'); + + // Execute configuration update definitions with logging of success. + $updateHelper->executeUpdate('openideal_comment', 'openideal_comment_update_8001'); + + // Output logged messages to related channel of update execution. + return $updateHelper->logger()->output(); +}