1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-24 14:30:56 +01:00

Persist excluded recipients when saving mail

Summary:
Fixes T5185. The fundamental issue is that this `excludePHIDs` property was not saved, so the logic went like this:

  - Generate `excludePHIDs` correctly.
  - Pass `excludePHIDs` through the stack.
  - Perform some other computations correctly.
  - Queue the mail for the daemons, throwing it away. {icon bomb}
  - Daemons process mail with empty `excludePHIDs` list.

Store it in the persistent properties array instead.

Also remove the "override self mail" thing, since it's only used by `bin/mail send-test` and suffers from the same issue. I think it's too useless to fix, since even if you get caught by it, `bin/mail` makes it clear why the message was dropped.

Test Plan:
Notable:

  - `exclude` present in properties
  - Exclusion reason under RECIPIENTS header

{P1229}

Reviewers: btrahan

Reviewed By: btrahan

Subscribers: epriestley

Maniphest Tasks: T5185

Differential Revision: https://secure.phabricator.com/D10234
This commit is contained in:
epriestley 2014-08-12 12:28:07 -07:00
parent c9835c4492
commit 500506bfef
2 changed files with 5 additions and 16 deletions

View file

@ -117,7 +117,6 @@ final class PhabricatorMailManagementSendTestWorkflow
->addCCs($ccs) ->addCCs($ccs)
->setSubject($subject) ->setSubject($subject)
->setBody($body) ->setBody($body)
->setOverrideNoSelfMailPreference(true)
->setIsHTML($is_html) ->setIsHTML($is_html)
->setIsBulk($is_bulk) ->setIsBulk($is_bulk)
->setMailTags($tags); ->setMailTags($tags);

View file

@ -17,8 +17,6 @@ final class PhabricatorMetaMTAMail extends PhabricatorMetaMTADAO {
protected $message; protected $message;
protected $relatedPHID; protected $relatedPHID;
private $excludePHIDs = array();
private $overrideNoSelfMail = false;
private $recipientExpansionMap; private $recipientExpansionMap;
public function __construct() { public function __construct() {
@ -115,21 +113,13 @@ final class PhabricatorMetaMTAMail extends PhabricatorMetaMTADAO {
return $this; return $this;
} }
public function setExcludeMailRecipientPHIDs($exclude) { public function setExcludeMailRecipientPHIDs(array $exclude) {
$this->excludePHIDs = $exclude; $this->setParam('exclude', $exclude);
return $this; return $this;
} }
private function getExcludeMailRecipientPHIDs() { private function getExcludeMailRecipientPHIDs() {
return $this->excludePHIDs; return $this->getParam('exclude', array());
}
public function getOverrideNoSelfMailPreference() {
return $this->overrideNoSelfMail;
}
public function setOverrideNoSelfMailPreference($override) {
$this->overrideNoSelfMail = $override;
return $this;
} }
public function getTranslation(array $objects) { public function getTranslation(array $objects) {
@ -828,7 +818,7 @@ final class PhabricatorMetaMTAMail extends PhabricatorMetaMTADAO {
->withPHIDs(array($from_phid)) ->withPHIDs(array($from_phid))
->execute(); ->execute();
$from_user = head($from_user); $from_user = head($from_user);
if ($from_user && !$this->getOverrideNoSelfMailPreference()) { if ($from_user) {
$pref_key = PhabricatorUserPreferences::PREFERENCE_NO_SELF_MAIL; $pref_key = PhabricatorUserPreferences::PREFERENCE_NO_SELF_MAIL;
$exclude_self = $from_user $exclude_self = $from_user
->loadPreferences() ->loadPreferences()