mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-14 10:52:41 +01:00
8410cbecb0
Summary: Ref T4375. This doesn't get everything (I figure I'll clean up the actual UI strings when I touch the UIs) but should get the bulk of the URIs and class names and stuff. Test Plan: Clicked every calendar-related link I could find/grep, they all still seem to work. URIs now say "event". Reviewers: btrahan, chad Reviewed By: btrahan CC: aran Maniphest Tasks: T4375 Differential Revision: https://secure.phabricator.com/D8147
54 lines
1.3 KiB
PHP
54 lines
1.3 KiB
PHP
<?php
|
|
|
|
final class PhabricatorCalendarEventDeleteController
|
|
extends PhabricatorCalendarController {
|
|
|
|
private $id;
|
|
|
|
public function willProcessRequest(array $data) {
|
|
$this->id = idx($data, 'id');
|
|
}
|
|
|
|
public function processRequest() {
|
|
$request = $this->getRequest();
|
|
$user = $request->getUser();
|
|
|
|
$status = id(new PhabricatorCalendarEventQuery())
|
|
->setViewer($user)
|
|
->withIDs(array($this->id))
|
|
->requireCapabilities(
|
|
array(
|
|
PhabricatorPolicyCapability::CAN_VIEW,
|
|
PhabricatorPolicyCapability::CAN_EDIT,
|
|
))
|
|
->executeOne();
|
|
|
|
if (!$status) {
|
|
return new Aphront404Response();
|
|
}
|
|
|
|
if ($request->isFormPost()) {
|
|
$status->delete();
|
|
$uri = new PhutilURI($this->getApplicationURI());
|
|
$uri->setQueryParams(
|
|
array(
|
|
'deleted' => true,
|
|
));
|
|
return id(new AphrontRedirectResponse())
|
|
->setURI($uri);
|
|
}
|
|
|
|
$dialog = new AphrontDialogView();
|
|
$dialog->setUser($user);
|
|
$dialog->setTitle(pht('Really delete status?'));
|
|
$dialog->appendChild(
|
|
pht('Permanently delete this status? This action can not be undone.'));
|
|
$dialog->addSubmitButton(pht('Delete'));
|
|
$dialog->addCancelButton(
|
|
$this->getApplicationURI('event/'));
|
|
|
|
return id(new AphrontDialogResponse())->setDialog($dialog);
|
|
|
|
}
|
|
|
|
}
|