1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-18 21:02:41 +01:00

Update People for handleRequest

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
This commit is contained in:
Josh Cox 2016-08-25 13:33:47 -04:00
parent a88dc2afc2
commit a7dcbe5980
3 changed files with 12 additions and 32 deletions

View file

@ -3,20 +3,12 @@
final class PhabricatorPeopleApproveController final class PhabricatorPeopleApproveController
extends PhabricatorPeopleController { extends PhabricatorPeopleController {
private $id; public function handleRequest(AphrontRequest $request) {
$viewer = $request->getViewer();
public function willProcessRequest(array $data) {
$this->id = idx($data, 'id');
}
public function processRequest() {
$request = $this->getRequest();
$admin = $request->getUser();
$user = id(new PhabricatorPeopleQuery()) $user = id(new PhabricatorPeopleQuery())
->setViewer($admin) ->setViewer($viewer)
->withIDs(array($this->id)) ->withIDs(array($request->getURIData('id')))
->executeOne(); ->executeOne();
if (!$user) { if (!$user) {
return new Aphront404Response(); return new Aphront404Response();
@ -26,7 +18,7 @@ final class PhabricatorPeopleApproveController
if ($request->isFormPost()) { if ($request->isFormPost()) {
id(new PhabricatorUserEditor()) id(new PhabricatorUserEditor())
->setActor($admin) ->setActor($viewer)
->approveUser($user, true); ->approveUser($user, true);
$title = pht( $title = pht(
@ -39,12 +31,12 @@ final class PhabricatorPeopleApproveController
'Your Phabricator account (%s) has been approved by %s. You can '. 'Your Phabricator account (%s) has been approved by %s. You can '.
'login here:', 'login here:',
$user->getUsername(), $user->getUsername(),
$admin->getUsername()), $viewer->getUsername()),
PhabricatorEnv::getProductionURI('/')); PhabricatorEnv::getProductionURI('/'));
$mail = id(new PhabricatorMetaMTAMail()) $mail = id(new PhabricatorMetaMTAMail())
->addTos(array($user->getPHID())) ->addTos(array($user->getPHID()))
->addCCs(array($admin->getPHID())) ->addCCs(array($viewer->getPHID()))
->setSubject('[Phabricator] '.$title) ->setSubject('[Phabricator] '.$title)
->setForceDelivery(true) ->setForceDelivery(true)
->setBody($body) ->setBody($body)

View file

@ -3,8 +3,6 @@
final class PhabricatorPeopleListController final class PhabricatorPeopleListController
extends PhabricatorPeopleController { extends PhabricatorPeopleController {
private $key;
public function shouldAllowPublic() { public function shouldAllowPublic() {
return true; return true;
} }
@ -13,16 +11,12 @@ final class PhabricatorPeopleListController
return false; return false;
} }
public function willProcessRequest(array $data) { public function handleRequest(AphrontRequest $request) {
$this->key = idx($data, 'key');
}
public function processRequest() {
$this->requireApplicationCapability( $this->requireApplicationCapability(
PeopleBrowseUserDirectoryCapability::CAPABILITY); PeopleBrowseUserDirectoryCapability::CAPABILITY);
$controller = id(new PhabricatorApplicationSearchController()) $controller = id(new PhabricatorApplicationSearchController())
->setQueryKey($this->key) ->setQueryKey($request->getURIData('key'))
->setSearchEngine(new PhabricatorPeopleSearchEngine()) ->setSearchEngine(new PhabricatorPeopleSearchEngine())
->setNavigation($this->buildSideNavView()); ->setNavigation($this->buildSideNavView());

View file

@ -3,15 +3,9 @@
final class PhabricatorPeopleLogsController final class PhabricatorPeopleLogsController
extends PhabricatorPeopleController { extends PhabricatorPeopleController {
private $queryKey; public function handleRequest(AphrontRequest $request) {
$controller = id(new PhabricatorApplicationSearchController())
public function willProcessRequest(array $data) { ->setQueryKey($request->getURIData('queryKey'))
$this->queryKey = idx($data, 'queryKey');
}
public function processRequest() {
$controller = id(new PhabricatorApplicationSearchController())
->setQueryKey($this->queryKey)
->setSearchEngine(new PhabricatorPeopleLogSearchEngine()) ->setSearchEngine(new PhabricatorPeopleLogSearchEngine())
->setNavigation($this->buildSideNavView()); ->setNavigation($this->buildSideNavView());