1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-26 16:52:41 +01:00

Don't show the delete button on a deleted document

Summary:
This doesn't actually contain any logic to prevent a user from deleting a
document twice, but it makes it significantly harder to do so.

Test Plan:
Went to edit a document, saw the delete button. Clicked it, then went back to
the edit view, and no longer saw the delete button.

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, Korvin

Differential Revision: https://secure.phabricator.com/D3952
This commit is contained in:
Ricky Elrod 2012-11-15 15:56:19 -08:00 committed by epriestley
parent 90dedc16a0
commit 7fac80cb9a

View file

@ -154,20 +154,22 @@ final class PhrictionEditController
->setErrors($errors);
}
$delete_button = null;
if ($document->getID()) {
$panel_header = 'Edit Phriction Document';
$submit_button = 'Save Changes';
$delete_button = phutil_render_tag(
'a',
array(
'href' => '/phriction/delete/'.$document->getID().'/',
'class' => 'grey button',
),
'Delete Document');
if ($document->getStatus() != PhrictionDocumentStatus::STATUS_DELETED) {
$delete_button = phutil_render_tag(
'a',
array(
'href' => '/phriction/delete/'.$document->getID().'/',
'class' => 'grey button',
),
'Delete Document');
}
} else {
$panel_header = 'Create New Phriction Document';
$submit_button = 'Create Document';
$delete_button = null;
}
$uri = $document->getSlug();