mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-01 03:02:43 +01:00
8756d82cf6
Summary: I'm pretty sure that `@group` annotations are useless now... see D9855. Also fixed various other minor issues. Test Plan: Eye-ball it. Reviewers: #blessed_reviewers, epriestley, chad Reviewed By: #blessed_reviewers, epriestley Subscribers: epriestley, Korvin, hach-que Differential Revision: https://secure.phabricator.com/D9859
50 lines
1.3 KiB
PHP
50 lines
1.3 KiB
PHP
<?php
|
|
|
|
final class PhabricatorCountdownDeleteController
|
|
extends PhabricatorCountdownController {
|
|
|
|
private $id;
|
|
|
|
public function willProcessRequest(array $data) {
|
|
$this->id = $data['id'];
|
|
}
|
|
|
|
public function processRequest() {
|
|
$request = $this->getRequest();
|
|
$user = $request->getUser();
|
|
|
|
$countdown = id(new PhabricatorCountdownQuery())
|
|
->setViewer($user)
|
|
->withIDs(array($this->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);
|
|
}
|
|
|
|
}
|