Add Disabled mode to landing revision ui
Summary: Fixes T4066. add `isActionDisabled()` to DifferentialLandingStrategy, which also explains why it is so. Make an appropriate pop-up in the controller. Also make the whole UI "workflow", and convert `createMenuItems()` to `createMenuItem()` (Singular). Test Plan: Click "Land to..." button in all kinds of revisions. Reviewers: epriestley, #blessed_reviewers Reviewed By: epriestley CC: Korvin, epriestley, aran Maniphest Tasks: T4066 Differential Revision: https://secure.phabricator.com/D8105
This commit is contained in:
@@ -68,6 +68,26 @@ final class DifferentialRevisionLandController extends DifferentialController {
|
||||
return id(new AphrontDialogResponse())->setDialog($dialog);
|
||||
}
|
||||
|
||||
$is_disabled = $this->pushStrategy->isActionDisabled(
|
||||
$viewer,
|
||||
$revision,
|
||||
$revision->getRepository());
|
||||
if ($is_disabled) {
|
||||
if (is_string($is_disabled)) {
|
||||
$explain = $is_disabled;
|
||||
} else {
|
||||
$explain = pht("This action is not currently enabled.");
|
||||
}
|
||||
$dialog = id(new AphrontDialogView())
|
||||
->setUser($viewer)
|
||||
->setTitle(pht("Can't land revision"))
|
||||
->appendChild($explain)
|
||||
->addCancelButton('/D'.$revision_id);
|
||||
|
||||
return id(new AphrontDialogResponse())->setDialog($dialog);
|
||||
}
|
||||
|
||||
|
||||
$prompt = hsprintf('%s<br><br>%s',
|
||||
pht(
|
||||
'This will squash and rebase revision %s, and push it to '.
|
||||
|
||||
Reference in New Issue
Block a user