Page MenuHomePhabricator

D19022.id45617.diff
No OneTemporary

D19022.id45617.diff

diff --git a/src/applications/differential/editor/DifferentialTransactionEditor.php b/src/applications/differential/editor/DifferentialTransactionEditor.php
--- a/src/applications/differential/editor/DifferentialTransactionEditor.php
+++ b/src/applications/differential/editor/DifferentialTransactionEditor.php
@@ -632,6 +632,8 @@
}
protected function getMailTo(PhabricatorLiskDAO $object) {
+ $this->requireReviewers($object);
+
$phids = array();
$phids[] = $object->getAuthorPHID();
foreach ($object->getReviewers() as $reviewer) {
@@ -645,6 +647,8 @@
}
protected function newMailUnexpandablePHIDs(PhabricatorLiskDAO $object) {
+ $this->requireReviewers($object);
+
$phids = array();
foreach ($object->getReviewers() as $reviewer) {
@@ -1737,4 +1741,25 @@
}
}
+ private function requireReviewers(DifferentialRevision $revision) {
+ if ($revision->hasAttachedReviewers()) {
+ return;
+ }
+
+ $with_reviewers = id(new DifferentialRevisionQuery())
+ ->setViewer($this->getActor())
+ ->needReviewers(true)
+ ->withPHIDs(array($revision->getPHID()))
+ ->executeOne();
+ if (!$with_reviewers) {
+ throw new Exception(
+ pht(
+ 'Failed to reload revision ("%s").',
+ $revision->getPHID()));
+ }
+
+ $revision->attachReviewers($with_reviewers->getReviewers());
+ }
+
+
}
diff --git a/src/applications/differential/storage/DifferentialRevision.php b/src/applications/differential/storage/DifferentialRevision.php
--- a/src/applications/differential/storage/DifferentialRevision.php
+++ b/src/applications/differential/storage/DifferentialRevision.php
@@ -583,6 +583,10 @@
return $this;
}
+ public function hasAttachedReviewers() {
+ return ($this->reviewerStatus !== self::ATTACHABLE);
+ }
+
public function getReviewerPHIDs() {
$reviewers = $this->getReviewers();
return mpull($reviewers, 'getReviewerPHID');

File Metadata

Mime Type
text/plain
Expires
Sun, Jan 12, 2:02 PM (13 h, 24 m)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6987158
Default Alt Text
D19022.id45617.diff (1 KB)

Event Timeline