mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-10 08:52:39 +01:00
Remove "Destroy" action for Countdown objects
Summary: fixes T12523 Test Plan: - view Countdown edit screen, Destroy action missing - checked that `./bin/remove destroy <some-countdown-phid>` removes the DB rows as expected Reviewers: epriestley Reviewed By: epriestley Subscribers: Korvin Maniphest Tasks: T12523 Differential Revision: https://secure.phabricator.com/D17659
This commit is contained in:
parent
149c1a6de7
commit
6886e9c12d
6 changed files with 14 additions and 60 deletions
|
@ -2408,7 +2408,6 @@ phutil_register_library_map(array(
|
|||
'PhabricatorCountdownDAO' => 'applications/countdown/storage/PhabricatorCountdownDAO.php',
|
||||
'PhabricatorCountdownDefaultEditCapability' => 'applications/countdown/capability/PhabricatorCountdownDefaultEditCapability.php',
|
||||
'PhabricatorCountdownDefaultViewCapability' => 'applications/countdown/capability/PhabricatorCountdownDefaultViewCapability.php',
|
||||
'PhabricatorCountdownDeleteController' => 'applications/countdown/controller/PhabricatorCountdownDeleteController.php',
|
||||
'PhabricatorCountdownEditController' => 'applications/countdown/controller/PhabricatorCountdownEditController.php',
|
||||
'PhabricatorCountdownEditEngine' => 'applications/countdown/editor/PhabricatorCountdownEditEngine.php',
|
||||
'PhabricatorCountdownEditor' => 'applications/countdown/editor/PhabricatorCountdownEditor.php',
|
||||
|
@ -7492,6 +7491,7 @@ phutil_register_library_map(array(
|
|||
'PhabricatorTokenReceiverInterface',
|
||||
'PhabricatorSpacesInterface',
|
||||
'PhabricatorProjectInterface',
|
||||
'PhabricatorDestructibleInterface',
|
||||
),
|
||||
'PhabricatorCountdownApplication' => 'PhabricatorApplication',
|
||||
'PhabricatorCountdownController' => 'PhabricatorController',
|
||||
|
@ -7499,7 +7499,6 @@ phutil_register_library_map(array(
|
|||
'PhabricatorCountdownDAO' => 'PhabricatorLiskDAO',
|
||||
'PhabricatorCountdownDefaultEditCapability' => 'PhabricatorPolicyCapability',
|
||||
'PhabricatorCountdownDefaultViewCapability' => 'PhabricatorPolicyCapability',
|
||||
'PhabricatorCountdownDeleteController' => 'PhabricatorCountdownController',
|
||||
'PhabricatorCountdownEditController' => 'PhabricatorCountdownController',
|
||||
'PhabricatorCountdownEditEngine' => 'PhabricatorEditEngine',
|
||||
'PhabricatorCountdownEditor' => 'PhabricatorApplicationTransactionEditor',
|
||||
|
|
|
@ -48,8 +48,6 @@ final class PhabricatorCountdownApplication extends PhabricatorApplication {
|
|||
=> 'PhabricatorCountdownCommentController',
|
||||
$this->getEditRoutePattern('edit/')
|
||||
=> 'PhabricatorCountdownEditController',
|
||||
'delete/(?P<id>[1-9]\d*)/'
|
||||
=> 'PhabricatorCountdownDeleteController',
|
||||
),
|
||||
);
|
||||
}
|
||||
|
|
|
@ -6,6 +6,4 @@ abstract class PhabricatorCountdownController extends PhabricatorController {
|
|||
return $this->newApplicationMenu()
|
||||
->setSearchEngine(new PhabricatorCountdownSearchEngine());
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -1,45 +0,0 @@
|
|||
<?php
|
||||
|
||||
final class PhabricatorCountdownDeleteController
|
||||
extends PhabricatorCountdownController {
|
||||
|
||||
public function handleRequest(AphrontRequest $request) {
|
||||
$viewer = $request->getViewer();
|
||||
$id = $request->getURIData('id');
|
||||
|
||||
$countdown = id(new PhabricatorCountdownQuery())
|
||||
->setViewer($viewer)
|
||||
->withIDs(array($id))
|
||||
->requireCapabilities(
|
||||
array(
|
||||
PhabricatorPolicyCapability::CAN_VIEW,
|
||||
PhabricatorPolicyCapability::CAN_EDIT,
|
||||
))
|
||||
->executeOne();
|
||||
|
||||
if (!$countdown) {
|
||||
return new Aphront404Response();
|
||||
}
|
||||
|
||||
if ($request->isFormPost()) {
|
||||
$countdown->delete();
|
||||
return id(new AphrontRedirectResponse())
|
||||
->setURI('/countdown/');
|
||||
}
|
||||
|
||||
$inst = pht(
|
||||
'Are you sure you want to delete the countdown %s?',
|
||||
$countdown->getTitle());
|
||||
|
||||
$dialog = new AphrontDialogView();
|
||||
$dialog->setUser($request->getUser());
|
||||
$dialog->setTitle(pht('Really delete this countdown?'));
|
||||
$dialog->appendChild(phutil_tag('p', array(), $inst));
|
||||
$dialog->addSubmitButton(pht('Delete'));
|
||||
$dialog->addCancelButton('/countdown/');
|
||||
$dialog->setSubmitURI($request->getPath());
|
||||
|
||||
return id(new AphrontDialogResponse())->setDialog($dialog);
|
||||
}
|
||||
|
||||
}
|
|
@ -102,14 +102,6 @@ final class PhabricatorCountdownViewController
|
|||
->setDisabled(!$can_edit)
|
||||
->setWorkflow(!$can_edit));
|
||||
|
||||
$curtain->addAction(
|
||||
id(new PhabricatorActionView())
|
||||
->setIcon('fa-times')
|
||||
->setName(pht('Delete Countdown'))
|
||||
->setHref($this->getApplicationURI("delete/{$id}/"))
|
||||
->setDisabled(!$can_edit)
|
||||
->setWorkflow(true));
|
||||
|
||||
return $curtain;
|
||||
}
|
||||
|
||||
|
|
|
@ -8,7 +8,8 @@ final class PhabricatorCountdown extends PhabricatorCountdownDAO
|
|||
PhabricatorApplicationTransactionInterface,
|
||||
PhabricatorTokenReceiverInterface,
|
||||
PhabricatorSpacesInterface,
|
||||
PhabricatorProjectInterface {
|
||||
PhabricatorProjectInterface,
|
||||
PhabricatorDestructibleInterface {
|
||||
|
||||
protected $title;
|
||||
protected $authorPHID;
|
||||
|
@ -141,8 +142,19 @@ final class PhabricatorCountdown extends PhabricatorCountdownDAO
|
|||
|
||||
/* -( PhabricatorSpacesInterface )------------------------------------------- */
|
||||
|
||||
|
||||
public function getSpacePHID() {
|
||||
return $this->spacePHID;
|
||||
}
|
||||
|
||||
/* -( PhabricatorDestructibleInterface )----------------------------------- */
|
||||
|
||||
|
||||
public function destroyObjectPermanently(
|
||||
PhabricatorDestructionEngine $engine) {
|
||||
|
||||
$this->openTransaction();
|
||||
$this->delete();
|
||||
$this->saveTransaction();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue