Remove delete function in PhamePost
Summary: Ref T9756, removes the ability to delete a PhamePost Test Plan: See link removed, unpublish post, publish post, new post. Reviewers: epriestley Reviewed By: epriestley Subscribers: Korvin Maniphest Tasks: T9756 Differential Revision: https://secure.phabricator.com/D14581
This commit is contained in:
		| @@ -3302,7 +3302,6 @@ phutil_register_library_map(array( | |||||||
|     'PhamePost' => 'applications/phame/storage/PhamePost.php', |     'PhamePost' => 'applications/phame/storage/PhamePost.php', | ||||||
|     'PhamePostCommentController' => 'applications/phame/controller/post/PhamePostCommentController.php', |     'PhamePostCommentController' => 'applications/phame/controller/post/PhamePostCommentController.php', | ||||||
|     'PhamePostController' => 'applications/phame/controller/post/PhamePostController.php', |     'PhamePostController' => 'applications/phame/controller/post/PhamePostController.php', | ||||||
|     'PhamePostDeleteController' => 'applications/phame/controller/post/PhamePostDeleteController.php', |  | ||||||
|     'PhamePostEditController' => 'applications/phame/controller/post/PhamePostEditController.php', |     'PhamePostEditController' => 'applications/phame/controller/post/PhamePostEditController.php', | ||||||
|     'PhamePostEditor' => 'applications/phame/editor/PhamePostEditor.php', |     'PhamePostEditor' => 'applications/phame/editor/PhamePostEditor.php', | ||||||
|     'PhamePostFramedController' => 'applications/phame/controller/post/PhamePostFramedController.php', |     'PhamePostFramedController' => 'applications/phame/controller/post/PhamePostFramedController.php', | ||||||
| @@ -7618,7 +7617,6 @@ phutil_register_library_map(array( | |||||||
|     ), |     ), | ||||||
|     'PhamePostCommentController' => 'PhamePostController', |     'PhamePostCommentController' => 'PhamePostController', | ||||||
|     'PhamePostController' => 'PhameController', |     'PhamePostController' => 'PhameController', | ||||||
|     'PhamePostDeleteController' => 'PhamePostController', |  | ||||||
|     'PhamePostEditController' => 'PhamePostController', |     'PhamePostEditController' => 'PhamePostController', | ||||||
|     'PhamePostEditor' => 'PhabricatorApplicationTransactionEditor', |     'PhamePostEditor' => 'PhabricatorApplicationTransactionEditor', | ||||||
|     'PhamePostFramedController' => 'PhamePostController', |     'PhamePostFramedController' => 'PhamePostController', | ||||||
|   | |||||||
| @@ -44,7 +44,6 @@ final class PhabricatorPhameApplication extends PhabricatorApplication { | |||||||
|           '(?:(?P<filter>draft|all)/)?' => 'PhamePostListController', |           '(?:(?P<filter>draft|all)/)?' => 'PhamePostListController', | ||||||
|           '(?:query/(?P<queryKey>[^/]+)/)?' => 'PhamePostListController', |           '(?:query/(?P<queryKey>[^/]+)/)?' => 'PhamePostListController', | ||||||
|           'blogger/(?P<bloggername>[\w\.-_]+)/' => 'PhamePostListController', |           'blogger/(?P<bloggername>[\w\.-_]+)/' => 'PhamePostListController', | ||||||
|           'delete/(?P<id>[^/]+)/' => 'PhamePostDeleteController', |  | ||||||
|           'edit/(?:(?P<id>[^/]+)/)?' => 'PhamePostEditController', |           'edit/(?:(?P<id>[^/]+)/)?' => 'PhamePostEditController', | ||||||
|           'view/(?P<id>\d+)/' => 'PhamePostViewController', |           'view/(?P<id>\d+)/' => 'PhamePostViewController', | ||||||
|           'publish/(?P<id>\d+)/' => 'PhamePostPublishController', |           'publish/(?P<id>\d+)/' => 'PhamePostPublishController', | ||||||
|   | |||||||
| @@ -1,41 +0,0 @@ | |||||||
| <?php |  | ||||||
|  |  | ||||||
| final class PhamePostDeleteController extends PhamePostController { |  | ||||||
|  |  | ||||||
|   public function handleRequest(AphrontRequest $request) { |  | ||||||
|     $viewer = $request->getViewer(); |  | ||||||
|  |  | ||||||
|     $post = id(new PhamePostQuery()) |  | ||||||
|       ->setViewer($viewer) |  | ||||||
|       ->withIDs(array($request->getURIData('id'))) |  | ||||||
|       ->requireCapabilities( |  | ||||||
|         array( |  | ||||||
|           PhabricatorPolicyCapability::CAN_EDIT, |  | ||||||
|         )) |  | ||||||
|       ->executeOne(); |  | ||||||
|     if (!$post) { |  | ||||||
|       return new Aphront404Response(); |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     if ($request->isFormPost()) { |  | ||||||
|       $post->delete(); |  | ||||||
|       return id(new AphrontRedirectResponse()) |  | ||||||
|         ->setURI('/phame/post/'); |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     $cancel_uri = $this->getApplicationURI('/post/view/'.$post->getID().'/'); |  | ||||||
|  |  | ||||||
|     $dialog = id(new AphrontDialogView()) |  | ||||||
|       ->setUser($viewer) |  | ||||||
|       ->setTitle(pht('Delete Post?')) |  | ||||||
|       ->appendChild( |  | ||||||
|         pht( |  | ||||||
|           'Really delete the post "%s"? It will be gone forever.', |  | ||||||
|           $post->getTitle())) |  | ||||||
|       ->addSubmitButton(pht('Delete')) |  | ||||||
|       ->addCancelButton($cancel_uri); |  | ||||||
|  |  | ||||||
|     return id(new AphrontDialogResponse())->setDialog($dialog); |  | ||||||
|   } |  | ||||||
|  |  | ||||||
| } |  | ||||||
| @@ -157,14 +157,6 @@ final class PhamePostViewController extends PhamePostController { | |||||||
|           ->setWorkflow(true)); |           ->setWorkflow(true)); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     $actions->addAction( |  | ||||||
|       id(new PhabricatorActionView()) |  | ||||||
|         ->setIcon('fa-times') |  | ||||||
|         ->setHref($this->getApplicationURI('post/delete/'.$id.'/')) |  | ||||||
|         ->setName(pht('Delete Post')) |  | ||||||
|         ->setDisabled(!$can_edit) |  | ||||||
|         ->setWorkflow(true)); |  | ||||||
|  |  | ||||||
|     $blog = $post->getBlog(); |     $blog = $post->getBlog(); | ||||||
|     $can_view_live = $blog && !$post->isDraft(); |     $can_view_live = $blog && !$post->isDraft(); | ||||||
|  |  | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Chad Little
					Chad Little