Page MenuHomePhabricator

D19289.id.diff
No OneTemporary

D19289.id.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
@@ -11,6 +11,7 @@
private $affectedPaths;
private $firstBroadcast = false;
private $wasBroadcasting;
+ private $isDraftDemotion;
public function getEditorApplicationClass() {
return 'PhabricatorDifferentialApplication';
@@ -134,6 +135,11 @@
// as "Commented" later. This should get cleaner after T10967.
$this->hasReviewTransaction = true;
break;
+ case DifferentialRevisionPlanChangesTransaction::TRANSACTIONTYPE:
+ if ($xaction->getMetadataValue('draft.demote')) {
+ $this->isDraftDemotion = true;
+ }
+ break;
}
}
@@ -497,27 +503,42 @@
protected function shouldSendMail(
PhabricatorLiskDAO $object,
array $xactions) {
-
- if (!$object->getShouldBroadcast()) {
- return false;
- }
-
return true;
}
protected function getMailTo(PhabricatorLiskDAO $object) {
- $this->requireReviewers($object);
+ if ($object->getShouldBroadcast()) {
+ $this->requireReviewers($object);
- $phids = array();
- $phids[] = $object->getAuthorPHID();
- foreach ($object->getReviewers() as $reviewer) {
- if ($reviewer->isResigned()) {
- continue;
+ $phids = array();
+ $phids[] = $object->getAuthorPHID();
+ foreach ($object->getReviewers() as $reviewer) {
+ if ($reviewer->isResigned()) {
+ continue;
+ }
+
+ $phids[] = $reviewer->getReviewerPHID();
}
+ return $phids;
+ }
- $phids[] = $reviewer->getReviewerPHID();
+ // If we're demoting a draft after a build failure, just notify the author.
+ if ($this->isDraftDemotion) {
+ $author_phid = $object->getAuthorPHID();
+ return array(
+ $author_phid,
+ );
}
- return $phids;
+
+ return array();
+ }
+
+ protected function getMailCC(PhabricatorLiskDAO $object) {
+ if (!$object->getShouldBroadcast()) {
+ return array();
+ }
+
+ return parent::getMailCC($object);
}
protected function newMailUnexpandablePHIDs(PhabricatorLiskDAO $object) {
@@ -1408,12 +1429,14 @@
return array(
'changedPriorToCommitURI' => $this->changedPriorToCommitURI,
'firstBroadcast' => $this->firstBroadcast,
+ 'isDraftDemotion' => $this->isDraftDemotion,
);
}
protected function loadCustomWorkerState(array $state) {
$this->changedPriorToCommitURI = idx($state, 'changedPriorToCommitURI');
$this->firstBroadcast = idx($state, 'firstBroadcast');
+ $this->isDraftDemotion = idx($state, 'isDraftDemotion');
return $this;
}

File Metadata

Mime Type
text/plain
Expires
Sat, May 18, 10:06 PM (4 w, 21 h ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6296959
Default Alt Text
D19289.id.diff (2 KB)

Event Timeline