diff --git a/src/applications/chatlog/PhabricatorChatLogChannelQuery.php b/src/applications/chatlog/PhabricatorChatLogChannelQuery.php index e1f38f3562..0930423fcb 100644 --- a/src/applications/chatlog/PhabricatorChatLogChannelQuery.php +++ b/src/applications/chatlog/PhabricatorChatLogChannelQuery.php @@ -4,12 +4,18 @@ final class PhabricatorChatLogChannelQuery extends PhabricatorCursorPagedPolicyAwareQuery { private $channels; + private $channelIDs; public function withChannelNames(array $channels) { $this->channels = $channels; return $this; } + public function withIDs(array $channel_ids) { + $this->channelIDs = $channel_ids; + return $this; + } + public function loadPage() { $table = new PhabricatorChatLogChannel(); $conn_r = $table->establishConnection('r'); @@ -32,6 +38,14 @@ final class PhabricatorChatLogChannelQuery $where[] = $this->buildPagingClause($conn_r); + if ($this->channelIDs) { + $where[] = qsprintf( + $conn_r, + 'id IN (%Ld)', + $this->channelIDs); + + } + if ($this->channels) { $where[] = qsprintf( $conn_r, diff --git a/src/applications/chatlog/controller/PhabricatorChatLogChannelListController.php b/src/applications/chatlog/controller/PhabricatorChatLogChannelListController.php index 13469f5b5e..5db5cd0bee 100644 --- a/src/applications/chatlog/controller/PhabricatorChatLogChannelListController.php +++ b/src/applications/chatlog/controller/PhabricatorChatLogChannelListController.php @@ -39,12 +39,13 @@ final class PhabricatorChatLogChannelListController '', )); - $title = pht('Channel List.'); + $title = pht('Channel List'); $header = id(new PhabricatorHeaderView()) ->setHeader($title); $panel = id(new AphrontPanelView()) + ->appendChild($table) ->setNoBackground(true); $crumbs = $this @@ -54,16 +55,12 @@ final class PhabricatorChatLogChannelListController ->setName(pht('Channel List')) ->setHref($this->getApplicationURI())); - $panel->appendChild( + return $this->buildStandardPageResponse( array( $crumbs, $header, - $table - )); - - - return $this->buildStandardPageResponse( - $panel, + $panel, + ), array( 'title' => 'Channel List', )); diff --git a/src/applications/chatlog/controller/PhabricatorChatLogChannelLogController.php b/src/applications/chatlog/controller/PhabricatorChatLogChannelLogController.php index 1e1cb1a3e2..1e98428f96 100644 --- a/src/applications/chatlog/controller/PhabricatorChatLogChannelLogController.php +++ b/src/applications/chatlog/controller/PhabricatorChatLogChannelLogController.php @@ -4,11 +4,9 @@ final class PhabricatorChatLogChannelLogController extends PhabricatorChatLogController { private $channelID; - private $channelName; public function willProcessRequest(array $data) { $this->channelID = $data['channelID']; - $this->channelName = $data['channelName']; } public function processRequest() { @@ -26,15 +24,13 @@ final class PhabricatorChatLogChannelLogController ->setViewer($user) ->withChannelIDs(array($this->channelID)); - $channels = id(new PhabricatorChatLogChannelQuery()) - ->setViewer($user) - ->execute(); + $channel = id(new PhabricatorChatLogChannelQuery()) + ->setViewer($user) + ->withIDs(array($this->channelID)) + ->executeOne(); - foreach ($channels as $channel) { - if ($channel->getID() == $this->channelID) { - $this->channelName = $channel->getChannelName(); - break; - } + if (!$channel) { + return new Aphront404Response(); } list($after, $before, $map) = $this->getPagingParameters($request, $query); @@ -138,14 +134,13 @@ final class PhabricatorChatLogChannelLogController ->buildApplicationCrumbs() ->addCrumb( id(new PhabricatorCrumbView()) - ->setName($this->channelName) + ->setName($channel->getChannelName()) ->setHref($uri)); $form = id(new AphrontFormView()) ->setUser($user) ->setMethod('GET') ->setAction($uri) - ->appendChild($crumbs) ->appendChild( id(new AphrontFormTextControl()) ->setLabel('Date') @@ -158,6 +153,7 @@ final class PhabricatorChatLogChannelLogController return $this->buildStandardPageResponse( array( + $crumbs, hsprintf( '
%s
%s%s
', $form->render(),