public function processRequest()
 {
     $request = $this->getRequest();
     $user = $request->getUser();
     $query = new PhabricatorPasteQuery();
     $query->setViewer($user);
     $nav = $this->buildSideNavView();
     $filter = $nav->selectFilter($this->filter, 'my');
     switch ($filter) {
         case 'my':
             $query->withAuthorPHIDs(array($user->getPHID()));
             $title = pht('My Pastes');
             $nodata = pht("You haven't created any Pastes yet.");
             break;
         case 'all':
             $title = pht('All Pastes');
             $nodata = pht("There are no Pastes yet.");
             break;
     }
     $pager = new AphrontCursorPagerView();
     $pager->readFromRequest($request);
     $pastes = $query->executeWithCursorPager($pager);
     $list = $this->buildPasteList($pastes);
     $list->setHeader($title);
     $list->setPager($pager);
     $list->setNoDataString($nodata);
     $nav->appendChild($list);
     return $this->buildApplicationPage($nav, array('title' => $title, 'device' => true));
 }
 public function processRequest()
 {
     $request = $this->getRequest();
     $user = $request->getUser();
     $pager = new AphrontCursorPagerView();
     $pager->readFromRequest($request);
     $query = new PhabricatorPasteQuery();
     $query->setViewer($user);
     switch ($this->getFilter()) {
         case 'create':
         default:
             // if we successfully create a paste, we redirect to view it
             $created_paste_redirect = $this->processCreateRequest();
             if ($created_paste_redirect) {
                 return $created_paste_redirect;
             }
             $query->setLimit(10);
             $paste_list = $query->execute();
             $pager = null;
             break;
         case 'my':
             $query->withAuthorPHIDs(array($user->getPHID()));
             $paste_list = $query->executeWithCursorPager($pager);
             break;
         case 'all':
             $paste_list = $query->executeWithCursorPager($pager);
             break;
     }
     $side_nav = $this->buildSideNavView();
     $side_nav->selectFilter($this->getFilter());
     if ($this->getErrorView()) {
         $side_nav->appendChild($this->getErrorView());
     }
     switch ($this->getFilter()) {
         case 'create':
         default:
             $side_nav->appendChild($this->renderCreatePaste());
             $see_all = phutil_render_tag('a', array('href' => '/paste/filter/all'), 'See all Pastes');
             $header = "Recent Pastes";
             break;
         case 'my':
             $header = 'Your Pastes';
             break;
         case 'all':
             $header = 'All Pastes';
             break;
     }
     $this->loadHandles(mpull($paste_list, 'getAuthorPHID'));
     $list = $this->buildPasteList($paste_list);
     $list->setHeader($header);
     $list->setPager($pager);
     $side_nav->appendChild($list);
     return $this->buildApplicationPage($side_nav, array('title' => 'Paste', 'device' => true));
 }