From 7fac80cb9a57cb68ebb6760d3e3054a9627d14a4 Mon Sep 17 00:00:00 2001 From: Ricky Elrod Date: Thu, 15 Nov 2012 15:56:19 -0800 Subject: [PATCH] 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 --- .../controller/PhrictionEditController.php | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/src/applications/phriction/controller/PhrictionEditController.php b/src/applications/phriction/controller/PhrictionEditController.php index 774388fd1e..f15a466df7 100644 --- a/src/applications/phriction/controller/PhrictionEditController.php +++ b/src/applications/phriction/controller/PhrictionEditController.php @@ -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();