upgrade repository delete function to full-blown workflow

Summary: fancy title. really just make the delete() method aware of related objects and build a quick workflow which calls delete(). also make commit delete savvy about audit requests.

Test Plan: deleted a repository per the instructions given to me in the web UI

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, Korvin

Maniphest Tasks: T1416, T1958, T1372

Differential Revision: https://secure.phabricator.com/D3822
This commit is contained in:
Bob Trahan
2012-10-25 16:23:41 -07:00
parent da7940b0a8
commit 731a6900bd
6 changed files with 132 additions and 8 deletions

View File

@@ -35,21 +35,27 @@ final class PhabricatorRepositoryDeleteController
$request = $this->getRequest();
if ($request->isDialogFormPost()) {
$repository->delete();
return id(new AphrontRedirectResponse())->setURI('/repository/');
}
$dialog = new AphrontDialogView();
$text_1 = pht('If you really want to delete the repository, you must run:');
$command = 'bin/repository delete '.
phutil_escape_html($repository->getCallsign());
$text_2 = pht('Repositories touch many objects and as such deletes are '.
'prohibitively expensive to run from the web UI.');
$body = phutil_render_tag(
'div',
array(
'class' => 'phabricator-remarkup',
),
'<p>'.$text_1.'</p><p><tt>'.$command.'</tt></p><p>'.$text_2.'</p>');
$dialog
->setUser($request->getUser())
->setTitle('Really delete repository?')
->appendChild(
'<p>Really delete the "'.phutil_escape_html($repository->getName()).
'" ('.phutil_escape_html($repository->getCallsign()).') repository? '.
'This operation can not be undone.</p>')
->setTitle(pht('Really want to delete the repository?'))
->appendChild($body)
->setSubmitURI('/repository/delete/'.$this->id.'/')
->addSubmitButton('Delete Repository')
->addCancelButton('/repository/');
->addSubmitButton(pht('Okay'));
return id(new AphrontDialogResponse())->setDialog($dialog);
}