mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-20 04:20:55 +01:00
Update Ponder for handleRequest
Summary: Update all Ponder callsites. Test Plan: New Question, New Comment, New Answer, Vote Up and Down Reviewers: btrahan, epriestley Reviewed By: epriestley Subscribers: epriestley, Korvin Maniphest Tasks: T8628 Differential Revision: https://secure.phabricator.com/D13679
This commit is contained in:
parent
cf83db15d6
commit
1aed0e67a9
11 changed files with 43 additions and 99 deletions
|
@ -2,15 +2,9 @@
|
|||
|
||||
final class PonderAnswerCommentController extends PonderController {
|
||||
|
||||
private $id;
|
||||
|
||||
public function willProcessRequest(array $data) {
|
||||
$this->id = $data['id'];
|
||||
}
|
||||
|
||||
public function processRequest() {
|
||||
$request = $this->getRequest();
|
||||
$viewer = $request->getUser();
|
||||
public function handleRequest(AphrontRequest $request) {
|
||||
$viewer = $request->getViewer();
|
||||
$id = $request->getURIData('id');
|
||||
|
||||
if (!$request->isFormPost()) {
|
||||
return new Aphront400Response();
|
||||
|
@ -18,7 +12,7 @@ final class PonderAnswerCommentController extends PonderController {
|
|||
|
||||
$answer = id(new PonderAnswerQuery())
|
||||
->setViewer($viewer)
|
||||
->withIDs(array($this->id))
|
||||
->withIDs(array($id))
|
||||
->executeOne();
|
||||
if (!$answer) {
|
||||
return new Aphront404Response();
|
||||
|
|
|
@ -2,19 +2,13 @@
|
|||
|
||||
final class PonderAnswerEditController extends PonderController {
|
||||
|
||||
private $id;
|
||||
|
||||
public function willProcessRequest(array $data) {
|
||||
$this->id = $data['id'];
|
||||
}
|
||||
|
||||
public function processRequest() {
|
||||
$request = $this->getRequest();
|
||||
$viewer = $request->getUser();
|
||||
public function handleRequest(AphrontRequest $request) {
|
||||
$viewer = $request->getViewer();
|
||||
$id = $request->getURIData('id');
|
||||
|
||||
$answer = id(new PonderAnswerQuery())
|
||||
->setViewer($viewer)
|
||||
->withIDs(array($this->id))
|
||||
->withIDs(array($id))
|
||||
->requireCapabilities(
|
||||
array(
|
||||
PhabricatorPolicyCapability::CAN_VIEW,
|
||||
|
|
|
@ -2,19 +2,13 @@
|
|||
|
||||
final class PonderAnswerHistoryController extends PonderController {
|
||||
|
||||
private $id;
|
||||
|
||||
public function willProcessRequest(array $data) {
|
||||
$this->id = $data['id'];
|
||||
}
|
||||
|
||||
public function processRequest() {
|
||||
$request = $this->getRequest();
|
||||
$viewer = $request->getUser();
|
||||
public function handleRequest(AphrontRequest $request) {
|
||||
$viewer = $request->getViewer();
|
||||
$id = $request->getURIData('id');
|
||||
|
||||
$answer = id(new PonderAnswerQuery())
|
||||
->setViewer($viewer)
|
||||
->withIDs(array($this->id))
|
||||
->withIDs(array($id))
|
||||
->executeOne();
|
||||
if (!$answer) {
|
||||
return new Aphront404Response();
|
||||
|
|
|
@ -2,9 +2,8 @@
|
|||
|
||||
final class PonderAnswerSaveController extends PonderController {
|
||||
|
||||
public function processRequest() {
|
||||
$request = $this->getRequest();
|
||||
$viewer = $request->getUser();
|
||||
public function handleRequest(AphrontRequest $request) {
|
||||
$viewer = $request->getViewer();
|
||||
|
||||
if (!$request->isFormPost()) {
|
||||
return new Aphront400Response();
|
||||
|
|
|
@ -2,15 +2,9 @@
|
|||
|
||||
final class PonderQuestionCommentController extends PonderController {
|
||||
|
||||
private $id;
|
||||
|
||||
public function willProcessRequest(array $data) {
|
||||
$this->id = $data['id'];
|
||||
}
|
||||
|
||||
public function processRequest() {
|
||||
$request = $this->getRequest();
|
||||
$viewer = $request->getUser();
|
||||
public function handleRequest(AphrontRequest $request) {
|
||||
$viewer = $request->getViewer();
|
||||
$id = $request->getURIData('id');
|
||||
|
||||
if (!$request->isFormPost()) {
|
||||
return new Aphront400Response();
|
||||
|
@ -18,7 +12,7 @@ final class PonderQuestionCommentController extends PonderController {
|
|||
|
||||
$question = id(new PonderQuestionQuery())
|
||||
->setViewer($viewer)
|
||||
->withIDs(array($this->id))
|
||||
->withIDs(array($id))
|
||||
->executeOne();
|
||||
if (!$question) {
|
||||
return new Aphront404Response();
|
||||
|
|
|
@ -2,20 +2,14 @@
|
|||
|
||||
final class PonderQuestionEditController extends PonderController {
|
||||
|
||||
private $id;
|
||||
public function handleRequest(AphrontRequest $request) {
|
||||
$user = $request->getViewer();
|
||||
$id = $request->getURIData('id');
|
||||
|
||||
public function willProcessRequest(array $data) {
|
||||
$this->id = idx($data, 'id');
|
||||
}
|
||||
|
||||
public function processRequest() {
|
||||
$request = $this->getRequest();
|
||||
$user = $request->getUser();
|
||||
|
||||
if ($this->id) {
|
||||
if ($id) {
|
||||
$question = id(new PonderQuestionQuery())
|
||||
->setViewer($user)
|
||||
->withIDs(array($this->id))
|
||||
->withIDs(array($id))
|
||||
->requireCapabilities(
|
||||
array(
|
||||
PhabricatorPolicyCapability::CAN_VIEW,
|
||||
|
|
|
@ -2,19 +2,13 @@
|
|||
|
||||
final class PonderQuestionHistoryController extends PonderController {
|
||||
|
||||
private $id;
|
||||
|
||||
public function willProcessRequest(array $data) {
|
||||
$this->id = $data['id'];
|
||||
}
|
||||
|
||||
public function processRequest() {
|
||||
$request = $this->getRequest();
|
||||
$viewer = $request->getUser();
|
||||
public function handleRequest(AphrontRequest $request) {
|
||||
$viewer = $request->getViewer();
|
||||
$id = $request->getURIData('id');
|
||||
|
||||
$question = id(new PonderQuestionQuery())
|
||||
->setViewer($viewer)
|
||||
->withIDs(array($this->id))
|
||||
->withIDs(array($id))
|
||||
->executeOne();
|
||||
if (!$question) {
|
||||
return new Aphront404Response();
|
||||
|
|
|
@ -2,19 +2,15 @@
|
|||
|
||||
final class PonderQuestionListController extends PonderController {
|
||||
|
||||
private $queryKey;
|
||||
|
||||
public function shouldAllowPublic() {
|
||||
return true;
|
||||
}
|
||||
|
||||
public function willProcessRequest(array $data) {
|
||||
$this->queryKey = idx($data, 'queryKey');
|
||||
}
|
||||
public function handleRequest(AphrontRequest $request) {
|
||||
$query_key = $request->getURIData('queryKey');
|
||||
|
||||
public function processRequest() {
|
||||
$controller = id(new PhabricatorApplicationSearchController())
|
||||
->setQueryKey($this->queryKey)
|
||||
->setQueryKey($query_key)
|
||||
->setSearchEngine(new PonderQuestionSearchEngine())
|
||||
->setNavigation($this->buildSideNavView());
|
||||
|
||||
|
|
|
@ -3,21 +3,14 @@
|
|||
final class PonderQuestionStatusController
|
||||
extends PonderController {
|
||||
|
||||
private $status;
|
||||
private $id;
|
||||
|
||||
public function willProcessRequest(array $data) {
|
||||
$this->status = idx($data, 'status');
|
||||
$this->id = idx($data, 'id');
|
||||
}
|
||||
|
||||
public function processRequest() {
|
||||
$request = $this->getRequest();
|
||||
$viewer = $request->getUser();
|
||||
public function handleRequest(AphrontRequest $request) {
|
||||
$viewer = $request->getViewer();
|
||||
$id = $request->getURIData('id');
|
||||
$status = $request->getURIData('status');
|
||||
|
||||
$question = id(new PonderQuestionQuery())
|
||||
->setViewer($viewer)
|
||||
->withIDs(array($this->id))
|
||||
->withIDs(array($id))
|
||||
->requireCapabilities(
|
||||
array(
|
||||
PhabricatorPolicyCapability::CAN_VIEW,
|
||||
|
@ -28,7 +21,7 @@ final class PonderQuestionStatusController
|
|||
return new Aphront404Response();
|
||||
}
|
||||
|
||||
switch ($this->status) {
|
||||
switch ($status) {
|
||||
case 'open':
|
||||
$status = PonderQuestionStatus::STATUS_OPEN;
|
||||
break;
|
||||
|
|
|
@ -2,20 +2,13 @@
|
|||
|
||||
final class PonderQuestionViewController extends PonderController {
|
||||
|
||||
private $questionID;
|
||||
|
||||
public function willProcessRequest(array $data) {
|
||||
$this->questionID = $data['id'];
|
||||
}
|
||||
|
||||
public function processRequest() {
|
||||
|
||||
$request = $this->getRequest();
|
||||
$user = $request->getUser();
|
||||
public function handleRequest(AphrontRequest $request) {
|
||||
$user = $request->getViewer();
|
||||
$id = $request->getURIData('id');
|
||||
|
||||
$question = id(new PonderQuestionQuery())
|
||||
->setViewer($user)
|
||||
->withIDs(array($this->questionID))
|
||||
->withIDs(array($id))
|
||||
->needAnswers(true)
|
||||
->needViewerVotes(true)
|
||||
->executeOne();
|
||||
|
@ -61,7 +54,7 @@ final class PonderQuestionViewController extends PonderController {
|
|||
->addPropertyList($properties);
|
||||
|
||||
$crumbs = $this->buildApplicationCrumbs($this->buildSideNavView());
|
||||
$crumbs->addTextCrumb('Q'.$this->questionID, '/Q'.$this->questionID);
|
||||
$crumbs->addTextCrumb('Q'.$id, '/Q'.$id);
|
||||
|
||||
return $this->buildApplicationPage(
|
||||
array(
|
||||
|
|
|
@ -2,9 +2,8 @@
|
|||
|
||||
final class PonderVoteSaveController extends PonderController {
|
||||
|
||||
public function processRequest() {
|
||||
$request = $this->getRequest();
|
||||
$viewer = $request->getUser();
|
||||
public function handleRequest(AphrontRequest $request) {
|
||||
$viewer = $request->getViewer();
|
||||
$phid = $request->getStr('phid');
|
||||
$newvote = $request->getInt('vote');
|
||||
|
||||
|
|
Loading…
Reference in a new issue