1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-22 13:30:55 +01:00

Clean up some more handle callsites

Summary: Ref T7689.

Test Plan:
- Viewed Calendar browse and detail views.
- Went through Differential update workflow.

Reviewers: btrahan

Reviewed By: btrahan

Subscribers: epriestley

Maniphest Tasks: T7689

Differential Revision: https://secure.phabricator.com/D12341
This commit is contained in:
epriestley 2015-04-09 16:15:13 -07:00
parent b717298c9e
commit d44f05eead
4 changed files with 21 additions and 26 deletions

View file

@ -7,16 +7,15 @@ final class PhabricatorCalendarBrowseController
return true; return true;
} }
public function processRequest() { public function handleRequest(AphrontRequest $request) {
$now = time(); $viewer = $this->getViewer();
$request = $this->getRequest();
$user = $request->getUser();
$year_d = phabricator_format_local_time($now, $user, 'Y');
$year = $request->getInt('year', $year_d);
$month_d = phabricator_format_local_time($now, $user, 'm');
$month = $request->getInt('month', $month_d);
$day = phabricator_format_local_time($now, $user, 'j');
$now = time();
$year_d = phabricator_format_local_time($now, $viewer, 'Y');
$year = $request->getInt('year', $year_d);
$month_d = phabricator_format_local_time($now, $viewer, 'm');
$month = $request->getInt('month', $month_d);
$day = phabricator_format_local_time($now, $viewer, 'j');
$holidays = id(new PhabricatorCalendarHoliday())->loadAllWhere( $holidays = id(new PhabricatorCalendarHoliday())->loadAllWhere(
'day BETWEEN %s AND %s', 'day BETWEEN %s AND %s',
@ -24,7 +23,7 @@ final class PhabricatorCalendarBrowseController
"{$year}-{$month}-31"); "{$year}-{$month}-31");
$statuses = id(new PhabricatorCalendarEventQuery()) $statuses = id(new PhabricatorCalendarEventQuery())
->setViewer($user) ->setViewer($viewer)
->withDateRange( ->withDateRange(
strtotime("{$year}-{$month}-01"), strtotime("{$year}-{$month}-01"),
strtotime("{$year}-{$month}-01 next month")) strtotime("{$year}-{$month}-01 next month"))
@ -37,11 +36,11 @@ final class PhabricatorCalendarBrowseController
} }
$month_view->setBrowseURI($request->getRequestURI()); $month_view->setBrowseURI($request->getRequestURI());
$month_view->setUser($user); $month_view->setUser($viewer);
$month_view->setHolidays($holidays); $month_view->setHolidays($holidays);
$phids = mpull($statuses, 'getUserPHID'); $phids = mpull($statuses, 'getUserPHID');
$handles = $this->loadViewerHandles($phids); $handles = $viewer->loadHandles($phids);
/* Assign Colors */ /* Assign Colors */
$unique = array_unique($phids); $unique = array_unique($phids);

View file

@ -7,16 +7,16 @@ final class PhabricatorCalendarViewController
return true; return true;
} }
public function processRequest() { public function handleRequest(AphrontRequest $request) {
$user = $this->getRequest()->getUser(); $viewer = $this->getViewer();
$now = time(); $now = time();
$request = $this->getRequest(); $request = $this->getRequest();
$year_d = phabricator_format_local_time($now, $user, 'Y'); $year_d = phabricator_format_local_time($now, $viewer, 'Y');
$year = $request->getInt('year', $year_d); $year = $request->getInt('year', $year_d);
$month_d = phabricator_format_local_time($now, $user, 'm'); $month_d = phabricator_format_local_time($now, $viewer, 'm');
$month = $request->getInt('month', $month_d); $month = $request->getInt('month', $month_d);
$day = phabricator_format_local_time($now, $user, 'j'); $day = phabricator_format_local_time($now, $viewer, 'j');
$holidays = id(new PhabricatorCalendarHoliday())->loadAllWhere( $holidays = id(new PhabricatorCalendarHoliday())->loadAllWhere(
@ -25,8 +25,8 @@ final class PhabricatorCalendarViewController
"{$year}-{$month}-31"); "{$year}-{$month}-31");
$statuses = id(new PhabricatorCalendarEventQuery()) $statuses = id(new PhabricatorCalendarEventQuery())
->setViewer($user) ->setViewer($viewer)
->withInvitedPHIDs(array($user->getPHID())) ->withInvitedPHIDs(array($viewer->getPHID()))
->withDateRange( ->withDateRange(
strtotime("{$year}-{$month}-01"), strtotime("{$year}-{$month}-01"),
strtotime("{$year}-{$month}-01 next month")) strtotime("{$year}-{$month}-01 next month"))
@ -39,7 +39,7 @@ final class PhabricatorCalendarViewController
} }
$month_view->setBrowseURI($request->getRequestURI()); $month_view->setBrowseURI($request->getRequestURI());
$month_view->setUser($user); $month_view->setUser($viewer);
$month_view->setHolidays($holidays); $month_view->setHolidays($holidays);
if ($this->getNoticeView()) { if ($this->getNoticeView()) {
$month_view->setInfoView($this->getNoticeView()); $month_view->setInfoView($this->getNoticeView());

View file

@ -6,8 +6,7 @@ final class DifferentialChangesetViewController extends DifferentialController {
return true; return true;
} }
public function processRequest() { public function handleRequest(AphrontRequest $request) {
$request = $this->getRequest();
$viewer = $this->getViewer(); $viewer = $this->getViewer();
$author_phid = $viewer->getPHID(); $author_phid = $viewer->getPHID();

View file

@ -135,13 +135,10 @@ final class DifferentialDiffCreateController extends DifferentialController {
->setUser($viewer); ->setUser($viewer);
if ($revision) { if ($revision) {
$revision_handles = $this->loadViewerHandles(array($revision->getPHID()));
$revision_handle = head($revision_handles);
$form->appendChild( $form->appendChild(
id(new AphrontFormMarkupControl()) id(new AphrontFormMarkupControl())
->setLabel(pht('Updating Revision')) ->setLabel(pht('Updating Revision'))
->setValue($revision_handle->renderLink())); ->setValue($viewer->renderHandle($revision->getPHID())));
} }
if ($repository_phid) { if ($repository_phid) {