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,9 +154,11 @@ final class PhrictionEditController
->setErrors($errors); ->setErrors($errors);
} }
$delete_button = null;
if ($document->getID()) { if ($document->getID()) {
$panel_header = 'Edit Phriction Document'; $panel_header = 'Edit Phriction Document';
$submit_button = 'Save Changes'; $submit_button = 'Save Changes';
if ($document->getStatus() != PhrictionDocumentStatus::STATUS_DELETED) {
$delete_button = phutil_render_tag( $delete_button = phutil_render_tag(
'a', 'a',
array( array(
@ -164,10 +166,10 @@ final class PhrictionEditController
'class' => 'grey button', 'class' => 'grey button',
), ),
'Delete Document'); 'Delete Document');
}
} else { } else {
$panel_header = 'Create New Phriction Document'; $panel_header = 'Create New Phriction Document';
$submit_button = 'Create Document'; $submit_button = 'Create Document';
$delete_button = null;
} }
$uri = $document->getSlug(); $uri = $document->getSlug();