mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-10 08:52:39 +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 {
|
final class PonderAnswerCommentController extends PonderController {
|
||||||
|
|
||||||
private $id;
|
public function handleRequest(AphrontRequest $request) {
|
||||||
|
$viewer = $request->getViewer();
|
||||||
public function willProcessRequest(array $data) {
|
$id = $request->getURIData('id');
|
||||||
$this->id = $data['id'];
|
|
||||||
}
|
|
||||||
|
|
||||||
public function processRequest() {
|
|
||||||
$request = $this->getRequest();
|
|
||||||
$viewer = $request->getUser();
|
|
||||||
|
|
||||||
if (!$request->isFormPost()) {
|
if (!$request->isFormPost()) {
|
||||||
return new Aphront400Response();
|
return new Aphront400Response();
|
||||||
|
@ -18,7 +12,7 @@ final class PonderAnswerCommentController extends PonderController {
|
||||||
|
|
||||||
$answer = id(new PonderAnswerQuery())
|
$answer = id(new PonderAnswerQuery())
|
||||||
->setViewer($viewer)
|
->setViewer($viewer)
|
||||||
->withIDs(array($this->id))
|
->withIDs(array($id))
|
||||||
->executeOne();
|
->executeOne();
|
||||||
if (!$answer) {
|
if (!$answer) {
|
||||||
return new Aphront404Response();
|
return new Aphront404Response();
|
||||||
|
|
|
@ -2,19 +2,13 @@
|
||||||
|
|
||||||
final class PonderAnswerEditController extends PonderController {
|
final class PonderAnswerEditController extends PonderController {
|
||||||
|
|
||||||
private $id;
|
public function handleRequest(AphrontRequest $request) {
|
||||||
|
$viewer = $request->getViewer();
|
||||||
public function willProcessRequest(array $data) {
|
$id = $request->getURIData('id');
|
||||||
$this->id = $data['id'];
|
|
||||||
}
|
|
||||||
|
|
||||||
public function processRequest() {
|
|
||||||
$request = $this->getRequest();
|
|
||||||
$viewer = $request->getUser();
|
|
||||||
|
|
||||||
$answer = id(new PonderAnswerQuery())
|
$answer = id(new PonderAnswerQuery())
|
||||||
->setViewer($viewer)
|
->setViewer($viewer)
|
||||||
->withIDs(array($this->id))
|
->withIDs(array($id))
|
||||||
->requireCapabilities(
|
->requireCapabilities(
|
||||||
array(
|
array(
|
||||||
PhabricatorPolicyCapability::CAN_VIEW,
|
PhabricatorPolicyCapability::CAN_VIEW,
|
||||||
|
|
|
@ -2,19 +2,13 @@
|
||||||
|
|
||||||
final class PonderAnswerHistoryController extends PonderController {
|
final class PonderAnswerHistoryController extends PonderController {
|
||||||
|
|
||||||
private $id;
|
public function handleRequest(AphrontRequest $request) {
|
||||||
|
$viewer = $request->getViewer();
|
||||||
public function willProcessRequest(array $data) {
|
$id = $request->getURIData('id');
|
||||||
$this->id = $data['id'];
|
|
||||||
}
|
|
||||||
|
|
||||||
public function processRequest() {
|
|
||||||
$request = $this->getRequest();
|
|
||||||
$viewer = $request->getUser();
|
|
||||||
|
|
||||||
$answer = id(new PonderAnswerQuery())
|
$answer = id(new PonderAnswerQuery())
|
||||||
->setViewer($viewer)
|
->setViewer($viewer)
|
||||||
->withIDs(array($this->id))
|
->withIDs(array($id))
|
||||||
->executeOne();
|
->executeOne();
|
||||||
if (!$answer) {
|
if (!$answer) {
|
||||||
return new Aphront404Response();
|
return new Aphront404Response();
|
||||||
|
|
|
@ -2,9 +2,8 @@
|
||||||
|
|
||||||
final class PonderAnswerSaveController extends PonderController {
|
final class PonderAnswerSaveController extends PonderController {
|
||||||
|
|
||||||
public function processRequest() {
|
public function handleRequest(AphrontRequest $request) {
|
||||||
$request = $this->getRequest();
|
$viewer = $request->getViewer();
|
||||||
$viewer = $request->getUser();
|
|
||||||
|
|
||||||
if (!$request->isFormPost()) {
|
if (!$request->isFormPost()) {
|
||||||
return new Aphront400Response();
|
return new Aphront400Response();
|
||||||
|
|
|
@ -2,15 +2,9 @@
|
||||||
|
|
||||||
final class PonderQuestionCommentController extends PonderController {
|
final class PonderQuestionCommentController extends PonderController {
|
||||||
|
|
||||||
private $id;
|
public function handleRequest(AphrontRequest $request) {
|
||||||
|
$viewer = $request->getViewer();
|
||||||
public function willProcessRequest(array $data) {
|
$id = $request->getURIData('id');
|
||||||
$this->id = $data['id'];
|
|
||||||
}
|
|
||||||
|
|
||||||
public function processRequest() {
|
|
||||||
$request = $this->getRequest();
|
|
||||||
$viewer = $request->getUser();
|
|
||||||
|
|
||||||
if (!$request->isFormPost()) {
|
if (!$request->isFormPost()) {
|
||||||
return new Aphront400Response();
|
return new Aphront400Response();
|
||||||
|
@ -18,7 +12,7 @@ final class PonderQuestionCommentController extends PonderController {
|
||||||
|
|
||||||
$question = id(new PonderQuestionQuery())
|
$question = id(new PonderQuestionQuery())
|
||||||
->setViewer($viewer)
|
->setViewer($viewer)
|
||||||
->withIDs(array($this->id))
|
->withIDs(array($id))
|
||||||
->executeOne();
|
->executeOne();
|
||||||
if (!$question) {
|
if (!$question) {
|
||||||
return new Aphront404Response();
|
return new Aphront404Response();
|
||||||
|
|
|
@ -2,20 +2,14 @@
|
||||||
|
|
||||||
final class PonderQuestionEditController extends PonderController {
|
final class PonderQuestionEditController extends PonderController {
|
||||||
|
|
||||||
private $id;
|
public function handleRequest(AphrontRequest $request) {
|
||||||
|
$user = $request->getViewer();
|
||||||
|
$id = $request->getURIData('id');
|
||||||
|
|
||||||
public function willProcessRequest(array $data) {
|
if ($id) {
|
||||||
$this->id = idx($data, 'id');
|
|
||||||
}
|
|
||||||
|
|
||||||
public function processRequest() {
|
|
||||||
$request = $this->getRequest();
|
|
||||||
$user = $request->getUser();
|
|
||||||
|
|
||||||
if ($this->id) {
|
|
||||||
$question = id(new PonderQuestionQuery())
|
$question = id(new PonderQuestionQuery())
|
||||||
->setViewer($user)
|
->setViewer($user)
|
||||||
->withIDs(array($this->id))
|
->withIDs(array($id))
|
||||||
->requireCapabilities(
|
->requireCapabilities(
|
||||||
array(
|
array(
|
||||||
PhabricatorPolicyCapability::CAN_VIEW,
|
PhabricatorPolicyCapability::CAN_VIEW,
|
||||||
|
|
|
@ -2,19 +2,13 @@
|
||||||
|
|
||||||
final class PonderQuestionHistoryController extends PonderController {
|
final class PonderQuestionHistoryController extends PonderController {
|
||||||
|
|
||||||
private $id;
|
public function handleRequest(AphrontRequest $request) {
|
||||||
|
$viewer = $request->getViewer();
|
||||||
public function willProcessRequest(array $data) {
|
$id = $request->getURIData('id');
|
||||||
$this->id = $data['id'];
|
|
||||||
}
|
|
||||||
|
|
||||||
public function processRequest() {
|
|
||||||
$request = $this->getRequest();
|
|
||||||
$viewer = $request->getUser();
|
|
||||||
|
|
||||||
$question = id(new PonderQuestionQuery())
|
$question = id(new PonderQuestionQuery())
|
||||||
->setViewer($viewer)
|
->setViewer($viewer)
|
||||||
->withIDs(array($this->id))
|
->withIDs(array($id))
|
||||||
->executeOne();
|
->executeOne();
|
||||||
if (!$question) {
|
if (!$question) {
|
||||||
return new Aphront404Response();
|
return new Aphront404Response();
|
||||||
|
|
|
@ -2,19 +2,15 @@
|
||||||
|
|
||||||
final class PonderQuestionListController extends PonderController {
|
final class PonderQuestionListController extends PonderController {
|
||||||
|
|
||||||
private $queryKey;
|
|
||||||
|
|
||||||
public function shouldAllowPublic() {
|
public function shouldAllowPublic() {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function willProcessRequest(array $data) {
|
public function handleRequest(AphrontRequest $request) {
|
||||||
$this->queryKey = idx($data, 'queryKey');
|
$query_key = $request->getURIData('queryKey');
|
||||||
}
|
|
||||||
|
|
||||||
public function processRequest() {
|
|
||||||
$controller = id(new PhabricatorApplicationSearchController())
|
$controller = id(new PhabricatorApplicationSearchController())
|
||||||
->setQueryKey($this->queryKey)
|
->setQueryKey($query_key)
|
||||||
->setSearchEngine(new PonderQuestionSearchEngine())
|
->setSearchEngine(new PonderQuestionSearchEngine())
|
||||||
->setNavigation($this->buildSideNavView());
|
->setNavigation($this->buildSideNavView());
|
||||||
|
|
||||||
|
|
|
@ -3,21 +3,14 @@
|
||||||
final class PonderQuestionStatusController
|
final class PonderQuestionStatusController
|
||||||
extends PonderController {
|
extends PonderController {
|
||||||
|
|
||||||
private $status;
|
public function handleRequest(AphrontRequest $request) {
|
||||||
private $id;
|
$viewer = $request->getViewer();
|
||||||
|
$id = $request->getURIData('id');
|
||||||
public function willProcessRequest(array $data) {
|
$status = $request->getURIData('status');
|
||||||
$this->status = idx($data, 'status');
|
|
||||||
$this->id = idx($data, 'id');
|
|
||||||
}
|
|
||||||
|
|
||||||
public function processRequest() {
|
|
||||||
$request = $this->getRequest();
|
|
||||||
$viewer = $request->getUser();
|
|
||||||
|
|
||||||
$question = id(new PonderQuestionQuery())
|
$question = id(new PonderQuestionQuery())
|
||||||
->setViewer($viewer)
|
->setViewer($viewer)
|
||||||
->withIDs(array($this->id))
|
->withIDs(array($id))
|
||||||
->requireCapabilities(
|
->requireCapabilities(
|
||||||
array(
|
array(
|
||||||
PhabricatorPolicyCapability::CAN_VIEW,
|
PhabricatorPolicyCapability::CAN_VIEW,
|
||||||
|
@ -28,7 +21,7 @@ final class PonderQuestionStatusController
|
||||||
return new Aphront404Response();
|
return new Aphront404Response();
|
||||||
}
|
}
|
||||||
|
|
||||||
switch ($this->status) {
|
switch ($status) {
|
||||||
case 'open':
|
case 'open':
|
||||||
$status = PonderQuestionStatus::STATUS_OPEN;
|
$status = PonderQuestionStatus::STATUS_OPEN;
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -2,20 +2,13 @@
|
||||||
|
|
||||||
final class PonderQuestionViewController extends PonderController {
|
final class PonderQuestionViewController extends PonderController {
|
||||||
|
|
||||||
private $questionID;
|
public function handleRequest(AphrontRequest $request) {
|
||||||
|
$user = $request->getViewer();
|
||||||
public function willProcessRequest(array $data) {
|
$id = $request->getURIData('id');
|
||||||
$this->questionID = $data['id'];
|
|
||||||
}
|
|
||||||
|
|
||||||
public function processRequest() {
|
|
||||||
|
|
||||||
$request = $this->getRequest();
|
|
||||||
$user = $request->getUser();
|
|
||||||
|
|
||||||
$question = id(new PonderQuestionQuery())
|
$question = id(new PonderQuestionQuery())
|
||||||
->setViewer($user)
|
->setViewer($user)
|
||||||
->withIDs(array($this->questionID))
|
->withIDs(array($id))
|
||||||
->needAnswers(true)
|
->needAnswers(true)
|
||||||
->needViewerVotes(true)
|
->needViewerVotes(true)
|
||||||
->executeOne();
|
->executeOne();
|
||||||
|
@ -61,7 +54,7 @@ final class PonderQuestionViewController extends PonderController {
|
||||||
->addPropertyList($properties);
|
->addPropertyList($properties);
|
||||||
|
|
||||||
$crumbs = $this->buildApplicationCrumbs($this->buildSideNavView());
|
$crumbs = $this->buildApplicationCrumbs($this->buildSideNavView());
|
||||||
$crumbs->addTextCrumb('Q'.$this->questionID, '/Q'.$this->questionID);
|
$crumbs->addTextCrumb('Q'.$id, '/Q'.$id);
|
||||||
|
|
||||||
return $this->buildApplicationPage(
|
return $this->buildApplicationPage(
|
||||||
array(
|
array(
|
||||||
|
|
|
@ -2,9 +2,8 @@
|
||||||
|
|
||||||
final class PonderVoteSaveController extends PonderController {
|
final class PonderVoteSaveController extends PonderController {
|
||||||
|
|
||||||
public function processRequest() {
|
public function handleRequest(AphrontRequest $request) {
|
||||||
$request = $this->getRequest();
|
$viewer = $request->getViewer();
|
||||||
$viewer = $request->getUser();
|
|
||||||
$phid = $request->getStr('phid');
|
$phid = $request->getStr('phid');
|
||||||
$newvote = $request->getInt('vote');
|
$newvote = $request->getInt('vote');
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue