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

Apply Herald subscription effects immediately

Summary:
Fixes T8464. We could incorrectly use a cached value when computing CC's.

Just load a fresh value. There are no other callers that would benefit from this cache, so it's more complicated to reload it correctly prior to publishing than to just skip it.

Also make the PHID headers unique.

Test Plan:
  - Verified that users received mail about the transactions which caused them to be added to an object.
  - Veirfied that headers no longer have redundant values.

Reviewers: btrahan

Reviewed By: btrahan

Subscribers: epriestley

Maniphest Tasks: T8464

Differential Revision: https://secure.phabricator.com/D13206
This commit is contained in:
epriestley 2015-06-08 10:50:13 -07:00
parent 49570cb1c4
commit c3b11439f2
2 changed files with 4 additions and 6 deletions

View file

@ -176,6 +176,7 @@ final class PhabricatorMetaMTAMail extends PhabricatorMetaMTADAO {
} }
public function addPHIDHeaders($name, array $phids) { public function addPHIDHeaders($name, array $phids) {
$phids = array_unique($phids);
foreach ($phids as $phid) { foreach ($phids as $phid) {
$this->addHeader($name, '<'.$phid.'>'); $this->addHeader($name, '<'.$phid.'>');
} }

View file

@ -1018,11 +1018,7 @@ abstract class PhabricatorApplicationTransactionEditor
PhabricatorLiskDAO $object, PhabricatorLiskDAO $object,
array $xactions) { array $xactions) {
// Before sending mail or publishing feed stories, reload the object // Hook for edges or other properties that may need (re-)loading
// subscribers to pick up changes caused by Herald (or by other side effects
// in various transaction phases).
$this->loadSubscribers($object);
// Hook for other edges that may need (re-)loading
$object = $this->willPublish($object, $xactions); $object = $this->willPublish($object, $xactions);
$mailed = array(); $mailed = array();
@ -2424,7 +2420,8 @@ abstract class PhabricatorApplicationTransactionEditor
$has_support = false; $has_support = false;
if ($object instanceof PhabricatorSubscribableInterface) { if ($object instanceof PhabricatorSubscribableInterface) {
$phids[] = $this->subscribers; $phid = $object->getPHID();
$phids[] = PhabricatorSubscribersQuery::loadSubscribersForPHID($phid);
$has_support = true; $has_support = true;
} }