Skip to content

Commit 7fac80c

Browse files
Ricky Elrodepriestley
Ricky Elrod
authored and
epriestley
committed
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
1 parent 90dedc1 commit 7fac80c

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

src/applications/phriction/controller/PhrictionEditController.php

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -154,20 +154,22 @@ public function processRequest() {
154154
->setErrors($errors);
155155
}
156156

157+
$delete_button = null;
157158
if ($document->getID()) {
158159
$panel_header = 'Edit Phriction Document';
159160
$submit_button = 'Save Changes';
160-
$delete_button = phutil_render_tag(
161-
'a',
162-
array(
163-
'href' => '/phriction/delete/'.$document->getID().'/',
164-
'class' => 'grey button',
165-
),
166-
'Delete Document');
161+
if ($document->getStatus() != PhrictionDocumentStatus::STATUS_DELETED) {
162+
$delete_button = phutil_render_tag(
163+
'a',
164+
array(
165+
'href' => '/phriction/delete/'.$document->getID().'/',
166+
'class' => 'grey button',
167+
),
168+
'Delete Document');
169+
}
167170
} else {
168171
$panel_header = 'Create New Phriction Document';
169172
$submit_button = 'Create Document';
170-
$delete_button = null;
171173
}
172174

173175
$uri = $document->getSlug();

0 commit comments

Comments
 (0)