Differential D13677 Diff 33076 src/applications/phame/controller/post/PhamePostPublishController.php
Changeset View
Changeset View
Standalone View
Standalone View
src/applications/phame/controller/post/PhamePostPublishController.php
<?php | <?php | ||||
final class PhamePostPublishController extends PhameController { | final class PhamePostPublishController extends PhameController { | ||||
private $id; | public function handleRequest(AphrontRequest $request) { | ||||
public function willProcessRequest(array $data) { | |||||
$this->id = $data['id']; | |||||
} | |||||
public function processRequest() { | |||||
$request = $this->getRequest(); | |||||
$user = $request->getUser(); | $user = $request->getUser(); | ||||
$id = $request->getURIData('id'); | |||||
$post = id(new PhamePostQuery()) | $post = id(new PhamePostQuery()) | ||||
->setViewer($user) | ->setViewer($user) | ||||
->withIDs(array($this->id)) | ->withIDs(array($id)) | ||||
->requireCapabilities( | ->requireCapabilities( | ||||
array( | array( | ||||
PhabricatorPolicyCapability::CAN_EDIT, | PhabricatorPolicyCapability::CAN_EDIT, | ||||
)) | )) | ||||
->executeOne(); | ->executeOne(); | ||||
if (!$post) { | if (!$post) { | ||||
return new Aphront404Response(); | return new Aphront404Response(); | ||||
} | } | ||||
▲ Show 20 Lines • Show All 62 Lines • Show Last 20 Lines |