From c3b11439f281c7a2f6abfef710dc3fd7763faa65 Mon Sep 17 00:00:00 2001 From: epriestley Date: Mon, 8 Jun 2015 10:50:13 -0700 Subject: [PATCH] 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 --- .../metamta/storage/PhabricatorMetaMTAMail.php | 1 + .../editor/PhabricatorApplicationTransactionEditor.php | 9 +++------ 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/src/applications/metamta/storage/PhabricatorMetaMTAMail.php b/src/applications/metamta/storage/PhabricatorMetaMTAMail.php index 34a761f4ae..af7007cd87 100644 --- a/src/applications/metamta/storage/PhabricatorMetaMTAMail.php +++ b/src/applications/metamta/storage/PhabricatorMetaMTAMail.php @@ -176,6 +176,7 @@ final class PhabricatorMetaMTAMail extends PhabricatorMetaMTADAO { } public function addPHIDHeaders($name, array $phids) { + $phids = array_unique($phids); foreach ($phids as $phid) { $this->addHeader($name, '<'.$phid.'>'); } diff --git a/src/applications/transactions/editor/PhabricatorApplicationTransactionEditor.php b/src/applications/transactions/editor/PhabricatorApplicationTransactionEditor.php index bb8348d8b7..d9eb6a791b 100644 --- a/src/applications/transactions/editor/PhabricatorApplicationTransactionEditor.php +++ b/src/applications/transactions/editor/PhabricatorApplicationTransactionEditor.php @@ -1018,11 +1018,7 @@ abstract class PhabricatorApplicationTransactionEditor PhabricatorLiskDAO $object, array $xactions) { - // Before sending mail or publishing feed stories, reload the object - // 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 + // Hook for edges or other properties that may need (re-)loading $object = $this->willPublish($object, $xactions); $mailed = array(); @@ -2424,7 +2420,8 @@ abstract class PhabricatorApplicationTransactionEditor $has_support = false; if ($object instanceof PhabricatorSubscribableInterface) { - $phids[] = $this->subscribers; + $phid = $object->getPHID(); + $phids[] = PhabricatorSubscribersQuery::loadSubscribersForPHID($phid); $has_support = true; }