2011-04-04 07:03:27 +02:00
|
|
|
<?php
|
|
|
|
|
2012-03-10 00:46:25 +01:00
|
|
|
final class PhabricatorOwnersDeleteController
|
|
|
|
extends PhabricatorOwnersController {
|
2011-04-04 07:03:27 +02:00
|
|
|
|
|
|
|
private $id;
|
|
|
|
|
|
|
|
public function willProcessRequest(array $data) {
|
|
|
|
$this->id = $data['id'];
|
|
|
|
}
|
|
|
|
|
|
|
|
public function processRequest() {
|
|
|
|
$request = $this->getRequest();
|
|
|
|
$user = $request->getUser();
|
|
|
|
|
|
|
|
$package = id(new PhabricatorOwnersPackage())->load($this->id);
|
|
|
|
if (!$package) {
|
|
|
|
return new Aphront404Response();
|
|
|
|
}
|
|
|
|
|
|
|
|
if ($request->isDialogFormPost()) {
|
Detect package change and send out email
Summary:
For package creation and deletion, send email to all the owners For
package modification, detect important fields such as owners and paths, and then
send out emails to all owners (including deleted owners and current owners)
Also start using transaction for package creation/deletion/modification.
Test Plan:
- tested mail creation and deletion
- tested modification to auditing enabled, primary owners, owners, paths
Reviewers: epriestley, nh, vrana
Reviewed By: epriestley
CC: prithvi, aran, Koolvin
Differential Revision: https://secure.phabricator.com/D2470
2012-05-07 09:19:44 +02:00
|
|
|
$package->attachActorPHID($user->getPHID());
|
2011-04-04 07:03:27 +02:00
|
|
|
$package->delete();
|
|
|
|
return id(new AphrontRedirectResponse())->setURI('/owners/');
|
|
|
|
}
|
|
|
|
|
|
|
|
$dialog = id(new AphrontDialogView())
|
|
|
|
->setUser($user)
|
|
|
|
->setTitle('Really delete this package?')
|
|
|
|
->appendChild(
|
|
|
|
'<p>Are you sure you want to delete the "'.
|
|
|
|
phutil_escape_html($package->getName()).'" package? This operation '.
|
|
|
|
'can not be undone.</p>')
|
|
|
|
->addSubmitButton('Delete')
|
|
|
|
->addCancelButton('/owners/package/'.$package->getID().'/')
|
|
|
|
->setSubmitURI($request->getRequestURI());
|
|
|
|
|
|
|
|
return id(new AphrontDialogResponse())->setDialog($dialog);
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|