[MediaWiki-commits] [Gerrit] wikimedia...crm[master]: Use shell-safe verp when not making CiviMail records

2017-11-08 Thread jenkins-bot (Code Review)
jenkins-bot has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/387953 )

Change subject: Use shell-safe verp when not making CiviMail records
..


Use shell-safe verp when not making CiviMail records

This will give us the option to turn off CiviMail records if TY mail
start to lag too far behind.

Change-Id: I33997b0dec07fdfabdc029aa89b0d1d962fc4494
---
M sites/all/modules/thank_you/tests/phpunit/ThankYouTest.php
M sites/all/modules/thank_you/thank_you.module
2 files changed, 13 insertions(+), 5 deletions(-)

Approvals:
  Mepps: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/sites/all/modules/thank_you/tests/phpunit/ThankYouTest.php 
b/sites/all/modules/thank_you/tests/phpunit/ThankYouTest.php
index 6e1c8fa..03acdda 100644
--- a/sites/all/modules/thank_you/tests/phpunit/ThankYouTest.php
+++ b/sites/all/modules/thank_you/tests/phpunit/ThankYouTest.php
@@ -106,8 +106,7 @@
"{$this->message['first_name']} 
{$this->message['last_name']}",
$sent['to_name']
);
-   $expectedBounce = 'bounce-' .
-   str_replace( '@', '=', $this->message['email'] ) .
+   $expectedBounce = 
"ty.{$this->contact_id}.{$this->contribution_id}" .
'@donate.wikimedia.org';
$this->assertEquals( $expectedBounce, $sent['reply_to'] );
$this->assertRegExp( '/\$ 1.23/', $sent['html'] );
diff --git a/sites/all/modules/thank_you/thank_you.module 
b/sites/all/modules/thank_you/thank_you.module
index 17bdbb1..883cb68 100644
--- a/sites/all/modules/thank_you/thank_you.module
+++ b/sites/all/modules/thank_you/thank_you.module
@@ -144,8 +144,15 @@
$form['transaction_id'] = array(
'#type' => 'textfield',
'#title' => t('Transaction ID'),
-   '#description' => t('Some kind of key we would use to find your 
records, example: "CNTCT-1234"'),
+   '#description' => t('ID to show in the text of the email, for 
example: "CNTCT-1234"'),
'#default_value' => 'TEST-' . mt_rand(),
+   );
+
+   $form['contribution_id'] = array(
+   '#type' => 'textfield',
+   '#title' => t('Contribution ID'),
+   '#description' => t('Actual ID of contribution to be thanked, 
for example: 12345'),
+   '#default_value' => mt_rand(),
);
 
$form['recurring'] = array(
@@ -336,7 +343,8 @@
 'receive_date' => $mailingData['receive_date'],
 'recipient_address' => $mailingData['email'],
 'recurring' => $is_recurring,
-'transaction_id' => "CNTCT-{$mailingData['contact_id']}",
+'transaction_id' => "CNTCT-{$mailingData['contact_id']}", // shown in 
the body of the text
+   'contribution_id' => $contribution_id, // used for the bounce 
header
 'unsubscribe_link' => build_unsub_link( $contribution_id, 
$mailingData['email'], $locale ),
 'contribution_tags' => wmf_thank_you_get_tag_names($contribution_id),
 );
@@ -408,6 +416,7 @@
 function thank_you_send_mail( $params ) {
 $require_params = array(
 'amount',
+'contribution_id',
 'currency',
 'from_name',
 'from_address',
@@ -470,7 +479,7 @@
if ( $civi_queue_record ) {
$email['reply_to'] = $civi_queue_record->getVerp();
} else {
-   $email['reply_to'] = 'bounce-' . str_replace( '@', '=', 
$email['to_address'] ) . '@donate.wikimedia.org';
+   $email['reply_to'] = 
"ty.{$params['contact_id']}.{$params['contribution_id']}@donate.wikimedia.org";
}
 
try {

-- 
To view, visit https://gerrit.wikimedia.org/r/387953
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I33997b0dec07fdfabdc029aa89b0d1d962fc4494
Gerrit-PatchSet: 3
Gerrit-Project: wikimedia/fundraising/crm
Gerrit-Branch: master
Gerrit-Owner: Ejegg 
Gerrit-Reviewer: AndyRussG 
Gerrit-Reviewer: Cdentinger 
Gerrit-Reviewer: Eileen 
Gerrit-Reviewer: Ejegg 
Gerrit-Reviewer: Jgleeson 
Gerrit-Reviewer: Katie Horn 
Gerrit-Reviewer: Mepps 
Gerrit-Reviewer: XenoRyet 
Gerrit-Reviewer: jenkins-bot <>

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] wikimedia...crm[master]: Use shell-safe verp when not making CiviMail records

2017-11-01 Thread Ejegg (Code Review)
Ejegg has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/387953 )

Change subject: Use shell-safe verp when not making CiviMail records
..

Use shell-safe verp when not making CiviMail records

This will give us the option to turn off CiviMail records if TY mail
start to lag too far behind.

Change-Id: I33997b0dec07fdfabdc029aa89b0d1d962fc4494
---
M sites/all/modules/thank_you/thank_you.module
1 file changed, 12 insertions(+), 3 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/wikimedia/fundraising/crm 
refs/changes/53/387953/1

diff --git a/sites/all/modules/thank_you/thank_you.module 
b/sites/all/modules/thank_you/thank_you.module
index 17bdbb1..883cb68 100644
--- a/sites/all/modules/thank_you/thank_you.module
+++ b/sites/all/modules/thank_you/thank_you.module
@@ -144,8 +144,15 @@
$form['transaction_id'] = array(
'#type' => 'textfield',
'#title' => t('Transaction ID'),
-   '#description' => t('Some kind of key we would use to find your 
records, example: "CNTCT-1234"'),
+   '#description' => t('ID to show in the text of the email, for 
example: "CNTCT-1234"'),
'#default_value' => 'TEST-' . mt_rand(),
+   );
+
+   $form['contribution_id'] = array(
+   '#type' => 'textfield',
+   '#title' => t('Contribution ID'),
+   '#description' => t('Actual ID of contribution to be thanked, 
for example: 12345'),
+   '#default_value' => mt_rand(),
);
 
$form['recurring'] = array(
@@ -336,7 +343,8 @@
 'receive_date' => $mailingData['receive_date'],
 'recipient_address' => $mailingData['email'],
 'recurring' => $is_recurring,
-'transaction_id' => "CNTCT-{$mailingData['contact_id']}",
+'transaction_id' => "CNTCT-{$mailingData['contact_id']}", // shown in 
the body of the text
+   'contribution_id' => $contribution_id, // used for the bounce 
header
 'unsubscribe_link' => build_unsub_link( $contribution_id, 
$mailingData['email'], $locale ),
 'contribution_tags' => wmf_thank_you_get_tag_names($contribution_id),
 );
@@ -408,6 +416,7 @@
 function thank_you_send_mail( $params ) {
 $require_params = array(
 'amount',
+'contribution_id',
 'currency',
 'from_name',
 'from_address',
@@ -470,7 +479,7 @@
if ( $civi_queue_record ) {
$email['reply_to'] = $civi_queue_record->getVerp();
} else {
-   $email['reply_to'] = 'bounce-' . str_replace( '@', '=', 
$email['to_address'] ) . '@donate.wikimedia.org';
+   $email['reply_to'] = 
"ty.{$params['contact_id']}.{$params['contribution_id']}@donate.wikimedia.org";
}
 
try {

-- 
To view, visit https://gerrit.wikimedia.org/r/387953
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I33997b0dec07fdfabdc029aa89b0d1d962fc4494
Gerrit-PatchSet: 1
Gerrit-Project: wikimedia/fundraising/crm
Gerrit-Branch: master
Gerrit-Owner: Ejegg 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits