Adamw has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/75157


Change subject: Letter Subject is templated the same as the body
......................................................................

Letter Subject is templated the same as the body

This is a sloppy reuse of existing code, but it will make templated
subject lines possible, to support FR #993.

Change-Id: I5e390c17d38257e5244ffd8e3cf9fa17917e04b1
---
M sites/all/modules/wmf_common/wmf_communication/MailingTemplate.php
M sites/all/modules/wmf_common/wmf_communication/tests/TestThankyouTemplate.php
A 
sites/all/modules/wmf_common/wmf_communication/tests/templates/subject/thank_you.it.subject
3 files changed, 2 insertions(+), 10 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/wikimedia/fundraising/crm 
refs/changes/57/75157/1

diff --git a/sites/all/modules/wmf_common/wmf_communication/MailingTemplate.php 
b/sites/all/modules/wmf_common/wmf_communication/MailingTemplate.php
index e4c157e..049347a 100644
--- a/sites/all/modules/wmf_common/wmf_communication/MailingTemplate.php
+++ b/sites/all/modules/wmf_common/wmf_communication/MailingTemplate.php
@@ -22,11 +22,6 @@
  * class or in your derivative.
  */
 abstract class AbstractMailingTemplate implements IMailingTemplate {
-    /**
-     * @return string key into the DonationInterface i18n messages
-     */
-    abstract function getSubjectKey();
-
     abstract function getTemplateDir();
 
     abstract function getTemplateName();
@@ -40,7 +35,7 @@
     }
 
     function getSubject( $recipient ) {
-        return Translation::get_translated_message( $this->getSubjectKey(), 
$recipient->getLanguage() );
+        return trim( $this->getBodyTemplate( $recipient )->render( 'subject' ) 
);
     }
 
     function getBodyTemplate( $recipient ) {
diff --git 
a/sites/all/modules/wmf_common/wmf_communication/tests/TestThankyouTemplate.php 
b/sites/all/modules/wmf_common/wmf_communication/tests/TestThankyouTemplate.php
index d2613c3..fb3b693 100644
--- 
a/sites/all/modules/wmf_common/wmf_communication/tests/TestThankyouTemplate.php
+++ 
b/sites/all/modules/wmf_common/wmf_communication/tests/TestThankyouTemplate.php
@@ -3,10 +3,6 @@
 use wmf_communication\AbstractMailingTemplate;
 
 class TestThankyouTemplate extends AbstractMailingTemplate {
-    function getSubjectKey() {
-        return 'donate_interface-email-subject';
-    }
-
     function getTemplateName() {
         return 'thank_you';
     }
diff --git 
a/sites/all/modules/wmf_common/wmf_communication/tests/templates/subject/thank_you.it.subject
 
b/sites/all/modules/wmf_common/wmf_communication/tests/templates/subject/thank_you.it.subject
new file mode 100644
index 0000000..e0ae050
--- /dev/null
+++ 
b/sites/all/modules/wmf_common/wmf_communication/tests/templates/subject/thank_you.it.subject
@@ -0,0 +1 @@
+Grazie dalla Wikimedia Foundation

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I5e390c17d38257e5244ffd8e3cf9fa17917e04b1
Gerrit-PatchSet: 1
Gerrit-Project: wikimedia/fundraising/crm
Gerrit-Branch: master
Gerrit-Owner: Adamw <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to