1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-19 12:00:55 +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)
->setSubject($subject)
->setBody($body)
->setOverrideNoSelfMailPreference(true)
->setIsHTML($is_html)
->setIsBulk($is_bulk)
->setMailTags($tags);

View file

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