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 renderInline(DifferentialTransactionComment $comment, $is_html, $is_quote) { $changeset = $this->getChangeset($comment->getChangesetID()); if (!$changeset) { return null; } $content = $comment->getContent(); $content = $this->renderRemarkupContent($content, $is_html); if ($is_quote) { $header = $this->renderHeader($comment, $is_html, true); } else { $header = null; } if ($is_html) { $style = array('margin: 8px 0;', 'padding: 0 12px;'); if ($is_quote) { $style[] = 'color: #74777D;'; } $content = phutil_tag('div', array('style' => implode(' ', $style)), $content); } $parts = array($header, "\n", $content); if (!$is_html) { $parts = implode('', $parts); $parts = trim($parts); } if ($is_quote) { if ($is_html) { $parts = $this->quoteHTML($parts); } else { $parts = $this->quoteText($parts); } } return $parts; }