protected function renderResultList(array $mails, PhabricatorSavedQuery $query, array $handles)
 {
     assert_instances_of($mails, 'PhabricatorMetaMTAMail');
     $viewer = $this->requireViewer();
     $list = new PHUIObjectItemListView();
     foreach ($mails as $mail) {
         if ($mail->hasSensitiveContent()) {
             $header = phutil_tag('em', array(), pht('Content Redacted'));
         } else {
             $header = $mail->getSubject();
         }
         $item = id(new PHUIObjectItemView())->setUser($viewer)->setObject($mail)->setEpoch($mail->getDateCreated())->setObjectName(pht('Mail %d', $mail->getID()))->setHeader($header)->setHref($this->getURI('detail/' . $mail->getID() . '/'));
         $status = $mail->getStatus();
         $status_name = PhabricatorMailOutboundStatus::getStatusName($status);
         $status_icon = PhabricatorMailOutboundStatus::getStatusIcon($status);
         $status_color = PhabricatorMailOutboundStatus::getStatusColor($status);
         $item->setStatusIcon($status_icon . ' ' . $status_color, $status_name);
         $list->addItem($item);
     }
     return id(new PhabricatorApplicationSearchResultView())->setContent($list);
 }
 public function handleRequest(AphrontRequest $request)
 {
     $viewer = $this->getViewer();
     $mail = id(new PhabricatorMetaMTAMailQuery())->setViewer($viewer)->withIDs(array($request->getURIData('id')))->executeOne();
     if (!$mail) {
         return new Aphront404Response();
     }
     if ($mail->hasSensitiveContent()) {
         $title = pht('Content Redacted');
     } else {
         $title = $mail->getSubject();
     }
     $header = id(new PHUIHeaderView())->setHeader($title)->setUser($viewer)->setPolicyObject($mail);
     $status = $mail->getStatus();
     $name = PhabricatorMailOutboundStatus::getStatusName($status);
     $icon = PhabricatorMailOutboundStatus::getStatusIcon($status);
     $color = PhabricatorMailOutboundStatus::getStatusColor($status);
     $header->setStatus($icon, $color, $name);
     $crumbs = $this->buildApplicationCrumbs()->addTextCrumb(pht('Mail %d', $mail->getID()));
     $object_box = id(new PHUIObjectBoxView())->setHeader($header)->addPropertyList($this->buildMessageProperties($mail), pht('Message'))->addPropertyList($this->buildHeaderProperties($mail), pht('Headers'))->addPropertyList($this->buildDeliveryProperties($mail), pht('Delivery'))->addPropertyList($this->buildMetadataProperties($mail), pht('Metadata'));
     return $this->buildApplicationPage(array($crumbs, $object_box), array('title' => $title, 'pageObjects' => array($mail->getPHID())));
 }
 public function handleRequest(AphrontRequest $request)
 {
     $viewer = $this->getViewer();
     $mail = id(new PhabricatorMetaMTAMailQuery())->setViewer($viewer)->withIDs(array($request->getURIData('id')))->executeOne();
     if (!$mail) {
         return new Aphront404Response();
     }
     if ($mail->hasSensitiveContent()) {
         $title = pht('Content Redacted');
     } else {
         $title = $mail->getSubject();
     }
     $header = id(new PHUIHeaderView())->setHeader($title)->setUser($viewer)->setPolicyObject($mail)->setHeaderIcon('fa-envelope');
     $status = $mail->getStatus();
     $name = PhabricatorMailOutboundStatus::getStatusName($status);
     $icon = PhabricatorMailOutboundStatus::getStatusIcon($status);
     $color = PhabricatorMailOutboundStatus::getStatusColor($status);
     $header->setStatus($icon, $color, $name);
     $crumbs = $this->buildApplicationCrumbs()->addTextCrumb(pht('Mail %d', $mail->getID()))->setBorder(true);
     $object_box = id(new PHUIObjectBoxView())->setHeaderText(pht('Mail'))->setBackground(PHUIObjectBoxView::BLUE_PROPERTY)->addPropertyList($this->buildMessageProperties($mail), pht('Message'))->addPropertyList($this->buildHeaderProperties($mail), pht('Headers'))->addPropertyList($this->buildDeliveryProperties($mail), pht('Delivery'))->addPropertyList($this->buildMetadataProperties($mail), pht('Metadata'));
     $view = id(new PHUITwoColumnView())->setHeader($header)->setFooter($object_box);
     return $this->newPage()->setTitle($title)->setCrumbs($crumbs)->setPageObjectPHIDs(array($mail->getPHID()))->appendChild($view);
 }