mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-26 16:52:41 +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 $firstBroadcast = false;
|
||||
private $wasBroadcasting;
|
||||
private $isDraftDemotion;
|
||||
|
||||
public function getEditorApplicationClass() {
|
||||
return 'PhabricatorDifferentialApplication';
|
||||
|
@ -134,6 +135,11 @@ final class DifferentialTransactionEditor
|
|||
// 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 @@ final class DifferentialTransactionEditor
|
|||
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();
|
||||
}
|
||||
|
||||
$phids[] = $reviewer->getReviewerPHID();
|
||||
return $phids;
|
||||
}
|
||||
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) {
|
||||
|
@ -1408,12 +1429,14 @@ final class DifferentialTransactionEditor
|
|||
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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue