protected function nestCommentHistory(DifferentialTransactionComment $comment, array $comments_by_line_number, array $users_by_phid)
 {
     $nested = array();
     $previous_comments = $comments_by_line_number[$comment->getChangesetID()][$comment->getLineNumber()];
     foreach ($previous_comments as $previous_comment) {
         if ($previous_comment->getID() >= $comment->getID()) {
             break;
         }
         $nested = $this->indentForMail(array_merge($nested, explode("\n", $previous_comment->getContent())));
         $user = idx($users_by_phid, $previous_comment->getAuthorPHID(), null);
         if ($user) {
             array_unshift($nested, pht('%s wrote:', $user->getUserName()));
         }
     }
     $nested = array_merge($nested, explode("\n", $comment->getContent()));
     return implode("\n", $nested);
 }
 private function renderHeader(DifferentialTransactionComment $comment, $is_html, $with_author)
 {
     $changeset = $this->getChangeset($comment->getChangesetID());
     $path = $changeset->getFilename();
     // Only show the filename.
     $path = basename($path);
     $start = $comment->getLineNumber();
     $length = $comment->getLineLength();
     if ($length) {
         $range = pht('%s-%s', $start, $start + $length);
     } else {
         $range = $start;
     }
     $header = "{$path}:{$range}";
     if ($is_html) {
         $header = $this->renderHeaderBold($header);
     }
     if ($with_author) {
         $author = $this->getAuthor($comment->getAuthorPHID());
     } else {
         $author = null;
     }
     if ($author) {
         $byline = $author->getName();
         if ($is_html) {
             $byline = $this->renderHeaderBold($byline);
         }
         $header = pht('%s wrote in %s', $byline, $header);
     }
     if ($is_html) {
         $link_href = $this->getInlineURI($comment);
         if ($link_href) {
             $link_style = array('float: right;', 'text-decoration: none;');
             $link = phutil_tag('a', array('style' => implode(' ', $link_style), 'href' => $link_href), pht('View Inline'));
         } else {
             $link = null;
         }
         $header = $this->renderHeaderBlock(array($link, $header));
     }
     return $header;
 }