@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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

+36 -13
+36 -13
src/applications/differential/editor/DifferentialTransactionEditor.php
··· 11 11 private $affectedPaths; 12 12 private $firstBroadcast = false; 13 13 private $wasBroadcasting; 14 + private $isDraftDemotion; 14 15 15 16 public function getEditorApplicationClass() { 16 17 return 'PhabricatorDifferentialApplication'; ··· 133 134 // If we have a review transaction, we'll skip marking the user 134 135 // as "Commented" later. This should get cleaner after T10967. 135 136 $this->hasReviewTransaction = true; 137 + break; 138 + case DifferentialRevisionPlanChangesTransaction::TRANSACTIONTYPE: 139 + if ($xaction->getMetadataValue('draft.demote')) { 140 + $this->isDraftDemotion = true; 141 + } 136 142 break; 137 143 } 138 144 } ··· 497 503 protected function shouldSendMail( 498 504 PhabricatorLiskDAO $object, 499 505 array $xactions) { 500 - 501 - if (!$object->getShouldBroadcast()) { 502 - return false; 503 - } 504 - 505 506 return true; 506 507 } 507 508 508 509 protected function getMailTo(PhabricatorLiskDAO $object) { 509 - $this->requireReviewers($object); 510 + if ($object->getShouldBroadcast()) { 511 + $this->requireReviewers($object); 512 + 513 + $phids = array(); 514 + $phids[] = $object->getAuthorPHID(); 515 + foreach ($object->getReviewers() as $reviewer) { 516 + if ($reviewer->isResigned()) { 517 + continue; 518 + } 510 519 511 - $phids = array(); 512 - $phids[] = $object->getAuthorPHID(); 513 - foreach ($object->getReviewers() as $reviewer) { 514 - if ($reviewer->isResigned()) { 515 - continue; 520 + $phids[] = $reviewer->getReviewerPHID(); 516 521 } 522 + return $phids; 523 + } 517 524 518 - $phids[] = $reviewer->getReviewerPHID(); 525 + // If we're demoting a draft after a build failure, just notify the author. 526 + if ($this->isDraftDemotion) { 527 + $author_phid = $object->getAuthorPHID(); 528 + return array( 529 + $author_phid, 530 + ); 519 531 } 520 - return $phids; 532 + 533 + return array(); 534 + } 535 + 536 + protected function getMailCC(PhabricatorLiskDAO $object) { 537 + if (!$object->getShouldBroadcast()) { 538 + return array(); 539 + } 540 + 541 + return parent::getMailCC($object); 521 542 } 522 543 523 544 protected function newMailUnexpandablePHIDs(PhabricatorLiskDAO $object) { ··· 1408 1429 return array( 1409 1430 'changedPriorToCommitURI' => $this->changedPriorToCommitURI, 1410 1431 'firstBroadcast' => $this->firstBroadcast, 1432 + 'isDraftDemotion' => $this->isDraftDemotion, 1411 1433 ); 1412 1434 } 1413 1435 1414 1436 protected function loadCustomWorkerState(array $state) { 1415 1437 $this->changedPriorToCommitURI = idx($state, 'changedPriorToCommitURI'); 1416 1438 $this->firstBroadcast = idx($state, 'firstBroadcast'); 1439 + $this->isDraftDemotion = idx($state, 'isDraftDemotion'); 1417 1440 return $this; 1418 1441 } 1419 1442