mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-30 02:32:42 +01:00
When a draft's builds fail and it demotes to "Changes Planned + Draft", notify the author (only) via email
Summary: Depends on D19288. Ref T13110. In addition to kicking revisions back to "Changes Planned" when builds fail, notify the author that they need to fix their awful garbage change. (The actual email could be more useful than it currently is.) Test Plan: Created a revision with failing remote builds, saw email about the problem generate. Maniphest Tasks: T13110 Differential Revision: https://secure.phabricator.com/D19289
This commit is contained in:
parent
f4f3311312
commit
804f9817c3
1 changed files with 37 additions and 14 deletions
|
@ -11,6 +11,7 @@ final class DifferentialTransactionEditor
|
||||||
private $affectedPaths;
|
private $affectedPaths;
|
||||||
private $firstBroadcast = false;
|
private $firstBroadcast = false;
|
||||||
private $wasBroadcasting;
|
private $wasBroadcasting;
|
||||||
|
private $isDraftDemotion;
|
||||||
|
|
||||||
public function getEditorApplicationClass() {
|
public function getEditorApplicationClass() {
|
||||||
return 'PhabricatorDifferentialApplication';
|
return 'PhabricatorDifferentialApplication';
|
||||||
|
@ -134,6 +135,11 @@ final class DifferentialTransactionEditor
|
||||||
// as "Commented" later. This should get cleaner after T10967.
|
// as "Commented" later. This should get cleaner after T10967.
|
||||||
$this->hasReviewTransaction = true;
|
$this->hasReviewTransaction = true;
|
||||||
break;
|
break;
|
||||||
|
case DifferentialRevisionPlanChangesTransaction::TRANSACTIONTYPE:
|
||||||
|
if ($xaction->getMetadataValue('draft.demote')) {
|
||||||
|
$this->isDraftDemotion = true;
|
||||||
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -497,27 +503,42 @@ final class DifferentialTransactionEditor
|
||||||
protected function shouldSendMail(
|
protected function shouldSendMail(
|
||||||
PhabricatorLiskDAO $object,
|
PhabricatorLiskDAO $object,
|
||||||
array $xactions) {
|
array $xactions) {
|
||||||
|
|
||||||
if (!$object->getShouldBroadcast()) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function getMailTo(PhabricatorLiskDAO $object) {
|
protected function getMailTo(PhabricatorLiskDAO $object) {
|
||||||
$this->requireReviewers($object);
|
if ($object->getShouldBroadcast()) {
|
||||||
|
$this->requireReviewers($object);
|
||||||
|
|
||||||
$phids = array();
|
$phids = array();
|
||||||
$phids[] = $object->getAuthorPHID();
|
$phids[] = $object->getAuthorPHID();
|
||||||
foreach ($object->getReviewers() as $reviewer) {
|
foreach ($object->getReviewers() as $reviewer) {
|
||||||
if ($reviewer->isResigned()) {
|
if ($reviewer->isResigned()) {
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
$phids[] = $reviewer->getReviewerPHID();
|
||||||
}
|
}
|
||||||
|
return $phids;
|
||||||
$phids[] = $reviewer->getReviewerPHID();
|
|
||||||
}
|
}
|
||||||
return $phids;
|
|
||||||
|
// 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 array();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function getMailCC(PhabricatorLiskDAO $object) {
|
||||||
|
if (!$object->getShouldBroadcast()) {
|
||||||
|
return array();
|
||||||
|
}
|
||||||
|
|
||||||
|
return parent::getMailCC($object);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function newMailUnexpandablePHIDs(PhabricatorLiskDAO $object) {
|
protected function newMailUnexpandablePHIDs(PhabricatorLiskDAO $object) {
|
||||||
|
@ -1408,12 +1429,14 @@ final class DifferentialTransactionEditor
|
||||||
return array(
|
return array(
|
||||||
'changedPriorToCommitURI' => $this->changedPriorToCommitURI,
|
'changedPriorToCommitURI' => $this->changedPriorToCommitURI,
|
||||||
'firstBroadcast' => $this->firstBroadcast,
|
'firstBroadcast' => $this->firstBroadcast,
|
||||||
|
'isDraftDemotion' => $this->isDraftDemotion,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function loadCustomWorkerState(array $state) {
|
protected function loadCustomWorkerState(array $state) {
|
||||||
$this->changedPriorToCommitURI = idx($state, 'changedPriorToCommitURI');
|
$this->changedPriorToCommitURI = idx($state, 'changedPriorToCommitURI');
|
||||||
$this->firstBroadcast = idx($state, 'firstBroadcast');
|
$this->firstBroadcast = idx($state, 'firstBroadcast');
|
||||||
|
$this->isDraftDemotion = idx($state, 'isDraftDemotion');
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue