mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-21 04:50:55 +01:00
Exclusion of actor as a mail recipient per preference can be overridden
Summary: Fixes T2797 Currently, emails are sent in no case to the actor if he has disabled the preference to send emails for his own actions. This won't let us send any test emails from the MetaMTA application to ourselves. This revision corrects the latter by specifically overriding the option for test emails. Test Plan: tried to send emails to myself. verified test mail got blocked with change not applied. applied the change. verified new change with both preference enabled and disabled did work fine. Reviewers: epriestley Reviewed By: epriestley CC: kai, aran, Korvin Maniphest Tasks: T2797 Differential Revision: https://secure.phabricator.com/D5398
This commit is contained in:
parent
404d514d0e
commit
eca49cb91f
2 changed files with 12 additions and 1 deletions
|
@ -32,6 +32,7 @@ final class PhabricatorMetaMTASendController
|
|||
$mail->setIsHTML($request->getInt('html'));
|
||||
$mail->setIsBulk($request->getInt('bulk'));
|
||||
$mail->setMailTags($request->getStrList('mailtags'));
|
||||
$mail->setOverrideNoSelfMailPreference(true);
|
||||
$mail->save();
|
||||
if ($request->getInt('immediately')) {
|
||||
$mail->sendNow();
|
||||
|
|
|
@ -23,6 +23,7 @@ final class PhabricatorMetaMTAMail extends PhabricatorMetaMTADAO {
|
|||
protected $relatedPHID;
|
||||
|
||||
private $excludePHIDs = array();
|
||||
private $overrideNoSelfMail = false;
|
||||
|
||||
public function __construct() {
|
||||
|
||||
|
@ -115,6 +116,15 @@ final class PhabricatorMetaMTAMail extends PhabricatorMetaMTADAO {
|
|||
return $this->excludePHIDs;
|
||||
}
|
||||
|
||||
public function getOverrideNoSelfMailPreference() {
|
||||
return $this->overrideNoSelfMail;
|
||||
}
|
||||
|
||||
public function setOverrideNoSelfMailPreference($override) {
|
||||
$this->overrideNoSelfMail = $override;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getTranslation(array $objects) {
|
||||
$default_translation = PhabricatorEnv::getEnvConfig('translation.provider');
|
||||
$return = null;
|
||||
|
@ -822,7 +832,7 @@ final class PhabricatorMetaMTAMail extends PhabricatorMetaMTADAO {
|
|||
$from_user = id(new PhabricatorUser())->loadOneWhere(
|
||||
'phid = %s',
|
||||
$from);
|
||||
if ($from_user) {
|
||||
if ($from_user && !$this->getOverrideNoSelfMailPreference()) {
|
||||
$pref_key = PhabricatorUserPreferences::PREFERENCE_NO_SELF_MAIL;
|
||||
$exclude_self = $from_user
|
||||
->loadPreferences()
|
||||
|
|
Loading…
Reference in a new issue