From f7aa87311ae570fb1544abc7c5bd8789c7d9fbf8 Mon Sep 17 00:00:00 2001 From: lkassianik Date: Wed, 19 Nov 2014 17:06:10 -0800 Subject: [PATCH] Add email preference links to email footers Summary: Ref T1217, Add link to email preferences to email template Test Plan: Add comment to object like Maniphest task, check that email has a footer with a link to email preferences. Reviewers: epriestley, #blessed_reviewers Reviewed By: epriestley, #blessed_reviewers Subscribers: Korvin, epriestley Maniphest Tasks: T1217 Differential Revision: https://secure.phabricator.com/D10883 --- .../option/PhabricatorMetaMTAConfigOptions.php | 14 ++++++++++++++ .../metamta/view/PhabricatorMetaMTAMailBody.php | 17 +++++++++++++++++ .../PhabricatorApplicationTransactionEditor.php | 3 ++- 3 files changed, 33 insertions(+), 1 deletion(-) diff --git a/src/applications/config/option/PhabricatorMetaMTAConfigOptions.php b/src/applications/config/option/PhabricatorMetaMTAConfigOptions.php index eceb8aaac0..850ff9c533 100644 --- a/src/applications/config/option/PhabricatorMetaMTAConfigOptions.php +++ b/src/applications/config/option/PhabricatorMetaMTAConfigOptions.php @@ -98,6 +98,12 @@ from replying. However, it may also cause deliverability issues -- notably, you currently can not send this header via Amazon SES, and enabling this option with SES will prevent delivery of any affected mail. EODOC +)); + + $email_preferences_description = $this->deformat(pht(<<deformat(pht(<<setSummary(pht('Show "To:" and "Cc:" footer hints in email.')) ->setDescription($recipient_hints_description), + $this->newOption('metamta.email-preferences', 'bool', true) + ->setBoolOptions( + array( + pht('Show Email Preferences Link'), + pht('No Email Preferences Link'), + )) + ->setSummary(pht('Show email preferences link in email.')) + ->setDescription($email_preferences_description), $this->newOption('metamta.precedence-bulk', 'bool', false) ->setBoolOptions( array( diff --git a/src/applications/metamta/view/PhabricatorMetaMTAMailBody.php b/src/applications/metamta/view/PhabricatorMetaMTAMailBody.php index 9e1a41f1c0..8d6c82cfc2 100644 --- a/src/applications/metamta/view/PhabricatorMetaMTAMailBody.php +++ b/src/applications/metamta/view/PhabricatorMetaMTAMailBody.php @@ -179,6 +179,23 @@ final class PhabricatorMetaMTAMailBody { return $this; } + /** + * Add a section with a link to email preferences. + * + * @return this + * @task compose + */ + public function addEmailPreferenceSection() { + if (!PhabricatorEnv::getEnvConfig('metamta.email-preferences')) { + return $this; + } + + $href = PhabricatorEnv::getProductionURI( + '/settings/panel/emailpreferences/'); + $this->addLinkSection(pht('EMAIL PREFERENCES'), $href); + + return $this; + } /** * Add an attachment. diff --git a/src/applications/transactions/editor/PhabricatorApplicationTransactionEditor.php b/src/applications/transactions/editor/PhabricatorApplicationTransactionEditor.php index ae225915b3..0a1878318b 100644 --- a/src/applications/transactions/editor/PhabricatorApplicationTransactionEditor.php +++ b/src/applications/transactions/editor/PhabricatorApplicationTransactionEditor.php @@ -1899,6 +1899,8 @@ abstract class PhabricatorApplicationTransactionEditor $body->addReplySection($reply_section); } + $body->addEmailPreferenceSection(); + $template ->setFrom($this->getActingAsPHID()) ->setSubjectPrefix($this->getMailSubjectPrefix()) @@ -2013,7 +2015,6 @@ abstract class PhabricatorApplicationTransactionEditor throw new Exception('Capability not supported.'); } - /** * @task mail */ -- 2.54.0