Skip to content
This repository has been archived by the owner on Mar 19, 2022. It is now read-only.

Commit

Permalink
Update People for handleRequest
Browse files Browse the repository at this point in the history
Summary: Ref T8628. Updates people controllers for handleRequest

Test Plan: Viewed the people list, viewed the activity logs, then went through the approval process for a new user account.

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: epriestley, yelirekim

Maniphest Tasks: T8628

Differential Revision: https://secure.phabricator.com/D16451
  • Loading branch information
Josh Cox committed Aug 25, 2016
1 parent a88dc2a commit a7dcbe5
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 32 deletions.
Expand Up @@ -3,20 +3,12 @@
final class PhabricatorPeopleApproveController
extends PhabricatorPeopleController {

private $id;

public function willProcessRequest(array $data) {
$this->id = idx($data, 'id');
}

public function processRequest() {

$request = $this->getRequest();
$admin = $request->getUser();
public function handleRequest(AphrontRequest $request) {
$viewer = $request->getViewer();

$user = id(new PhabricatorPeopleQuery())
->setViewer($admin)
->withIDs(array($this->id))
->setViewer($viewer)
->withIDs(array($request->getURIData('id')))
->executeOne();
if (!$user) {
return new Aphront404Response();
Expand All @@ -26,7 +18,7 @@ public function processRequest() {

if ($request->isFormPost()) {
id(new PhabricatorUserEditor())
->setActor($admin)
->setActor($viewer)
->approveUser($user, true);

$title = pht(
Expand All @@ -39,12 +31,12 @@ public function processRequest() {
'Your Phabricator account (%s) has been approved by %s. You can '.
'login here:',
$user->getUsername(),
$admin->getUsername()),
$viewer->getUsername()),
PhabricatorEnv::getProductionURI('/'));

$mail = id(new PhabricatorMetaMTAMail())
->addTos(array($user->getPHID()))
->addCCs(array($admin->getPHID()))
->addCCs(array($viewer->getPHID()))
->setSubject('[Phabricator] '.$title)
->setForceDelivery(true)
->setBody($body)
Expand Down
Expand Up @@ -3,8 +3,6 @@
final class PhabricatorPeopleListController
extends PhabricatorPeopleController {

private $key;

public function shouldAllowPublic() {
return true;
}
Expand All @@ -13,16 +11,12 @@ public function shouldRequireAdmin() {
return false;
}

public function willProcessRequest(array $data) {
$this->key = idx($data, 'key');
}

public function processRequest() {
public function handleRequest(AphrontRequest $request) {
$this->requireApplicationCapability(
PeopleBrowseUserDirectoryCapability::CAPABILITY);

$controller = id(new PhabricatorApplicationSearchController())
->setQueryKey($this->key)
->setQueryKey($request->getURIData('key'))
->setSearchEngine(new PhabricatorPeopleSearchEngine())
->setNavigation($this->buildSideNavView());

Expand Down
Expand Up @@ -3,15 +3,9 @@
final class PhabricatorPeopleLogsController
extends PhabricatorPeopleController {

private $queryKey;

public function willProcessRequest(array $data) {
$this->queryKey = idx($data, 'queryKey');
}

public function processRequest() {
$controller = id(new PhabricatorApplicationSearchController())
->setQueryKey($this->queryKey)
public function handleRequest(AphrontRequest $request) {
$controller = id(new PhabricatorApplicationSearchController())
->setQueryKey($request->getURIData('queryKey'))
->setSearchEngine(new PhabricatorPeopleLogSearchEngine())
->setNavigation($this->buildSideNavView());

Expand Down

0 comments on commit a7dcbe5

Please sign in to comment.