Differential D19807 Diff 47327 src/applications/differential/xaction/DifferentialRevisionUpdateTransaction.php
Changeset View
Changeset View
Standalone View
Standalone View
src/applications/differential/xaction/DifferentialRevisionUpdateTransaction.php
Show First 20 Lines • Show All 51 Lines • ▼ Show 20 Lines | final class DifferentialRevisionUpdateTransaction | ||||
public function applyExternalEffects($object, $value) { | public function applyExternalEffects($object, $value) { | ||||
$editor = $this->getEditor(); | $editor = $this->getEditor(); | ||||
$diff = $editor->requireDiff($value); | $diff = $editor->requireDiff($value); | ||||
// TODO: This can race with diff updates, particularly those from | // TODO: This can race with diff updates, particularly those from | ||||
// Harbormaster. See discussion in T8650. | // Harbormaster. See discussion in T8650. | ||||
$diff->setRevisionID($object->getID()); | $diff->setRevisionID($object->getID()); | ||||
$diff->save(); | $diff->save(); | ||||
} | |||||
public function didCommitTransaction($object, $value) { | |||||
$editor = $this->getEditor(); | |||||
$diff = $editor->requireDiff($value); | |||||
$omnipotent = PhabricatorUser::getOmnipotentUser(); | |||||
// If there are any outstanding buildables for this diff, tell | // If there are any outstanding buildables for this diff, tell | ||||
// Harbormaster that their containers need to be updated. This is | // Harbormaster that their containers need to be updated. This is | ||||
// common, because `arc` creates buildables so it can upload lint | // common, because `arc` creates buildables so it can upload lint | ||||
// and unit results. | // and unit results. | ||||
$buildables = id(new HarbormasterBuildableQuery()) | $buildables = id(new HarbormasterBuildableQuery()) | ||||
->setViewer(PhabricatorUser::getOmnipotentUser()) | ->setViewer($omnipotent) | ||||
->withManualBuildables(false) | ->withManualBuildables(false) | ||||
->withBuildablePHIDs(array($diff->getPHID())) | ->withBuildablePHIDs(array($diff->getPHID())) | ||||
->execute(); | ->execute(); | ||||
foreach ($buildables as $buildable) { | foreach ($buildables as $buildable) { | ||||
$buildable->sendMessage( | $buildable->sendMessage( | ||||
$this->getActor(), | $this->getActor(), | ||||
HarbormasterMessageType::BUILDABLE_CONTAINER, | HarbormasterMessageType::BUILDABLE_CONTAINER, | ||||
true); | true); | ||||
▲ Show 20 Lines • Show All 157 Lines • Show Last 20 Lines |