From 7cb67dc7257e2a90be00b1e8cefd331a8402662a Mon Sep 17 00:00:00 2001 From: epriestley Date: Mon, 26 Jun 2017 06:45:42 -0700 Subject: [PATCH] (stable) Restore "Land Revision" action to UI Summary: This was accidentally caught in the crossfire in D18150. This is stable enough to formalize instead of adding with an event hook. Test Plan: Looked at a candidate revision, saw "Land Revision" appear in UI again. Reviewers: chad Reviewed By: chad Differential Revision: https://secure.phabricator.com/D18154 --- .../DifferentialRevisionViewController.php | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/src/applications/differential/controller/DifferentialRevisionViewController.php b/src/applications/differential/controller/DifferentialRevisionViewController.php index f19ff37360..ab03ee6d81 100644 --- a/src/applications/differential/controller/DifferentialRevisionViewController.php +++ b/src/applications/differential/controller/DifferentialRevisionViewController.php @@ -615,6 +615,29 @@ final class DifferentialRevisionViewController extends DifferentialController { $curtain->addAction($relationship_submenu); } + $repository = $revision->getRepository(); + if ($repository && $repository->canPerformAutomation()) { + $revision_id = $revision->getID(); + + $op = new DrydockLandRepositoryOperation(); + $barrier = $op->getBarrierToLanding($viewer, $revision); + + if ($barrier) { + $can_land = false; + } else { + $can_land = true; + } + + $action = id(new PhabricatorActionView()) + ->setName(pht('Land Revision')) + ->setIcon('fa-fighter-jet') + ->setHref("/differential/revision/operation/{$revision_id}/") + ->setWorkflow(true) + ->setDisabled(!$can_land); + + $curtain->addAction($action); + } + return $curtain; }