From 6f26734eacbe2d1ed4f6e68a2849b9af3fad0baa Mon Sep 17 00:00:00 2001 From: bach Date: Fri, 17 Jun 2022 12:10:32 +0200 Subject: [PATCH] simplenews_mailjet_subscriptions: added rules action to respond to unsubscribe webhook --- ...les.reaction.mailjet_unsubscribe_event.yml | 30 ++++++++----------- ...et_subscriptions__usingmailjetmodule.patch | 8 +++-- 2 files changed, 18 insertions(+), 20 deletions(-) diff --git a/config/sync/rules.reaction.mailjet_unsubscribe_event.yml b/config/sync/rules.reaction.mailjet_unsubscribe_event.yml index b590145d..78f7f8bd 100644 --- a/config/sync/rules.reaction.mailjet_unsubscribe_event.yml +++ b/config/sync/rules.reaction.mailjet_unsubscribe_event.yml @@ -42,33 +42,29 @@ expression: value: rules_tokens: { } provides_mapping: { } - - - id: rules_condition - uuid: fe051e60-fd5e-4e90-a272-c526017966cb - weight: 0 - condition_id: rules_entity_is_of_type - negate: false - context_values: - type: mailjet_event - context_mapping: - entity: mailjet_event - context_processors: - type: - rules_tokens: { } - provides_mapping: { } actions: id: rules_action_set uuid: 5c91a286-ea41-47f7-b6a9-451cb4bb2324 weight: 0 actions: + - + id: rules_action + uuid: 9e184f51-443d-41ec-94c0-2c5ec5bdb1db + weight: -50 + action_id: 'rules_entity_create:commerce_log' + context_values: { } + context_mapping: { } + context_processors: { } + provides_mapping: + commerce_log_created: mailjet_event_log_created - id: rules_action uuid: 7eb49497-8830-46d4-975c-6b25b5d6dee6 - weight: 0 + weight: -49 action_id: rules_simplenews_mailjet_subscriptions_unsubscribe_from_list context_values: - listID: mailjet_event.event_field.mj_list_id - email: mailjet_event.event_field.email + listID: mailjet_event.event_field + email: mailjet_event.event_field context_mapping: { } context_processors: listID: diff --git a/patches/simplenews_mailjet_subscriptions__usingmailjetmodule.patch b/patches/simplenews_mailjet_subscriptions__usingmailjetmodule.patch index 759e0104..0cf72553 100644 --- a/patches/simplenews_mailjet_subscriptions__usingmailjetmodule.patch +++ b/patches/simplenews_mailjet_subscriptions__usingmailjetmodule.patch @@ -303,10 +303,10 @@ index 98342b5..f67ba96 100644 '#type' => 'submit', diff --git a/src/Plugin/RulesAction/UnsubscribeFromList.php b/src/Plugin/RulesAction/UnsubscribeFromList.php new file mode 100644 -index 0000000..b880ed2 +index 0000000..3f546ef --- /dev/null +++ b/src/Plugin/RulesAction/UnsubscribeFromList.php -@@ -0,0 +1,49 @@ +@@ -0,0 +1,51 @@ +notice("Unsubscribe webhook triggered for listID: " . $listID . ", and email: " . $email . "."); ++ \Drupal::logger('simplenews_mailjet_subscriptions')->notice(print_r($listID, true)); ++ // \Drupal::logger('simplenews_mailjet_subscriptions')->notice("Unsubscribe webhook triggered for listID: " . $listID . ", and email: " . $email . "."); ++ + // find corresponding simplenews list from mailjet listID + + // get subscriber entity