Differential D18745 Diff 44997 src/applications/differential/editor/DifferentialTransactionEditor.php
Changeset View
Changeset View
Standalone View
Standalone View
src/applications/differential/editor/DifferentialTransactionEditor.php
| Show First 20 Lines • Show All 1,198 Lines • ▼ Show 20 Lines | if (!$object->shouldBroadcast()) { | ||||
| HeraldMailableState::STATECONST, | HeraldMailableState::STATECONST, | ||||
| DifferentialHeraldStateReasons::REASON_DRAFT); | DifferentialHeraldStateReasons::REASON_DRAFT); | ||||
| } | } | ||||
| // If this edit didn't actually change the diff (for example, a user | // If this edit didn't actually change the diff (for example, a user | ||||
| // edited the title or changed subscribers), prevent "Run build plan" | // edited the title or changed subscribers), prevent "Run build plan" | ||||
| // and other similar rules from acting yet, since the build results will | // and other similar rules from acting yet, since the build results will | ||||
| // not (or, at least, should not) change unless the actual source changes. | // not (or, at least, should not) change unless the actual source changes. | ||||
| // We also don't run Differential builds if the update was caused by | |||||
| // discovering a commit, as the expectation is that Diffusion builds take | |||||
| // over once things land. | |||||
| $has_update = false; | $has_update = false; | ||||
| $has_commit = false; | |||||
| $type_update = DifferentialTransaction::TYPE_UPDATE; | $type_update = DifferentialTransaction::TYPE_UPDATE; | ||||
| foreach ($xactions as $xaction) { | foreach ($xactions as $xaction) { | ||||
| if ($xaction->getTransactionType() == $type_update) { | if ($xaction->getTransactionType() != $type_update) { | ||||
| continue; | |||||
| } | |||||
| if ($xaction->getMetadataValue('isCommitUpdate')) { | |||||
| $has_commit = true; | |||||
| } else { | |||||
| $has_update = true; | $has_update = true; | ||||
| break; | |||||
| } | } | ||||
| break; | |||||
| } | } | ||||
| if (!$has_update) { | if ($has_commit) { | ||||
| $adapter->setForbiddenAction( | |||||
| HeraldBuildableState::STATECONST, | |||||
| DifferentialHeraldStateReasons::REASON_LANDED); | |||||
| } else if (!$has_update) { | |||||
| $adapter->setForbiddenAction( | $adapter->setForbiddenAction( | ||||
| HeraldBuildableState::STATECONST, | HeraldBuildableState::STATECONST, | ||||
| DifferentialHeraldStateReasons::REASON_UNCHANGED); | DifferentialHeraldStateReasons::REASON_UNCHANGED); | ||||
| } | } | ||||
| return $adapter; | return $adapter; | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 373 Lines • Show Last 20 Lines | |||||