From deb20d6dae88eb95487a6398831b66a1fabed24b Mon Sep 17 00:00:00 2001 From: Chad Little Date: Fri, 31 Jul 2015 09:14:44 -0700 Subject: [PATCH] Update Chatlog for handleRequest Summary: Updates Chatlog Test Plan: Use Chatlog Reviewers: epriestley Reviewed By: epriestley Subscribers: epriestley, Korvin Differential Revision: https://secure.phabricator.com/D13763 --- ...habricatorChatLogChannelListController.php | 7 ++--- ...PhabricatorChatLogChannelLogController.php | 28 ++++++++----------- 2 files changed, 14 insertions(+), 21 deletions(-) diff --git a/src/applications/chatlog/controller/PhabricatorChatLogChannelListController.php b/src/applications/chatlog/controller/PhabricatorChatLogChannelListController.php index a7c5c68153..cdff189633 100644 --- a/src/applications/chatlog/controller/PhabricatorChatLogChannelListController.php +++ b/src/applications/chatlog/controller/PhabricatorChatLogChannelListController.php @@ -7,12 +7,11 @@ final class PhabricatorChatLogChannelListController return true; } - public function processRequest() { - $request = $this->getRequest(); - $user = $request->getUser(); + public function handleRequest(AphrontRequest $request) { + $viewer = $request->getViewer(); $channels = id(new PhabricatorChatLogChannelQuery()) - ->setViewer($user) + ->setViewer($viewer) ->execute(); $list = new PHUIObjectItemListView(); diff --git a/src/applications/chatlog/controller/PhabricatorChatLogChannelLogController.php b/src/applications/chatlog/controller/PhabricatorChatLogChannelLogController.php index 4281adf421..8084356ced 100644 --- a/src/applications/chatlog/controller/PhabricatorChatLogChannelLogController.php +++ b/src/applications/chatlog/controller/PhabricatorChatLogChannelLogController.php @@ -3,19 +3,13 @@ final class PhabricatorChatLogChannelLogController extends PhabricatorChatLogController { - private $channelID; - public function shouldAllowPublic() { return true; } - public function willProcessRequest(array $data) { - $this->channelID = $data['channelID']; - } - - public function processRequest() { - $request = $this->getRequest(); - $user = $request->getUser(); + public function handleRequest(AphrontRequest $request) { + $viewer = $request->getViewer(); + $id = $request->getURIData('channelID'); $uri = clone $request->getRequestURI(); $uri->setQueryParams(array()); @@ -25,12 +19,12 @@ final class PhabricatorChatLogChannelLogController $pager->setPageSize(250); $query = id(new PhabricatorChatLogQuery()) - ->setViewer($user) - ->withChannelIDs(array($this->channelID)); + ->setViewer($viewer) + ->withChannelIDs(array($id)); $channel = id(new PhabricatorChatLogChannelQuery()) - ->setViewer($user) - ->withIDs(array($this->channelID)) + ->setViewer($viewer) + ->withIDs(array($id)) ->executeOne(); if (!$channel) { @@ -115,7 +109,7 @@ final class PhabricatorChatLogChannelLogController $href = $uri->alter('at', $block['id']); $timestamp = $block['epoch']; - $timestamp = phabricator_datetime($timestamp, $user); + $timestamp = phabricator_datetime($timestamp, $viewer); $timestamp = phutil_tag( 'a', array( @@ -189,7 +183,7 @@ final class PhabricatorChatLogChannelLogController ->addTextCrumb($channel->getChannelName(), $uri); $form = id(new AphrontFormView()) - ->setUser($user) + ->setUser($viewer) ->setMethod('GET') ->setAction($uri) ->appendChild( @@ -273,7 +267,7 @@ final class PhabricatorChatLogChannelLogController AphrontRequest $request, PhabricatorChatLogQuery $query) { - $user = $request->getUser(); + $viewer = $request->getViewer(); $at_id = $request->getInt('at'); $at_date = $request->getStr('date'); @@ -298,7 +292,7 @@ final class PhabricatorChatLogChannelLogController ); } else if ($at_date) { - $timestamp = PhabricatorTime::parseLocalTime($at_date, $user); + $timestamp = PhabricatorTime::parseLocalTime($at_date, $viewer); if ($timestamp) { $context_logs = $query