Improve UX and messaging for certain errors when landing revisions
Summary: Ref T9994. - Allow errors to be dismissed. - Tailor messaging for closed/abandoned revisions. - Reduce scare messaging on land dialog, since it's not really that scary anymore. Test Plan: - Dismissed errors. - Hit new warnings. - Wasn't as scared when landing. Reviewers: chad Reviewed By: chad Maniphest Tasks: T9994 Differential Revision: https://secure.phabricator.com/D14886
This commit is contained in:
@@ -0,0 +1,56 @@
|
||||
<?php
|
||||
|
||||
final class DrydockRepositoryOperationDismissController
|
||||
extends DrydockController {
|
||||
|
||||
public function handleRequest(AphrontRequest $request) {
|
||||
$viewer = $request->getViewer();
|
||||
$id = $request->getURIData('id');
|
||||
|
||||
$operation = id(new DrydockRepositoryOperationQuery())
|
||||
->setViewer($viewer)
|
||||
->withIDs(array($id))
|
||||
->requireCapabilities(
|
||||
array(
|
||||
PhabricatorPolicyCapability::CAN_VIEW,
|
||||
PhabricatorPolicyCapability::CAN_EDIT,
|
||||
))
|
||||
->executeOne();
|
||||
if (!$operation) {
|
||||
return new Aphront404Response();
|
||||
}
|
||||
|
||||
$object_phid = $operation->getObjectPHID();
|
||||
$handles = $viewer->loadHandles(array($object_phid));
|
||||
$done_uri = $handles[$object_phid]->getURI();
|
||||
|
||||
if ($operation->getIsDismissed()) {
|
||||
return $this->newDialog()
|
||||
->setTitle(pht('Already Dismissed'))
|
||||
->appendParagraph(
|
||||
pht(
|
||||
'This operation has already been dismissed, and can not be '.
|
||||
'dismissed any further.'))
|
||||
->addCancelButton($done_uri);
|
||||
}
|
||||
|
||||
|
||||
if ($request->isFormPost()) {
|
||||
$operation
|
||||
->setIsDismissed(1)
|
||||
->save();
|
||||
|
||||
return id(new AphrontRedirectResponse())->setURI($done_uri);
|
||||
}
|
||||
|
||||
return $this->newDialog()
|
||||
->setTitle(pht('Dismiss Operation'))
|
||||
->appendParagraph(
|
||||
pht(
|
||||
'Dismiss this operation? It will no longer be shown, but logs '.
|
||||
'can be found in Drydock.'))
|
||||
->addSubmitButton(pht('Dismiss'))
|
||||
->addCancelButton($done_uri);
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user