private function renderInlines() { if (!$this->inlineComments) { return null; } $inlines_by_path = mgroup($this->inlineComments, 'getPathID'); $view = new PhabricatorInlineSummaryView(); foreach ($inlines_by_path as $path_id => $inlines) { $path = idx($this->pathMap, $path_id); if ($path === null) { continue; } $items = array(); foreach ($inlines as $inline) { $items[] = array('id' => $inline->getID(), 'line' => $inline->getLineNumber(), 'length' => $inline->getLineLength(), 'content' => PhabricatorInlineSummaryView::renderCommentContent($inline, $this->getEngine())); } $view->addCommentGroup($path, $items); } return $view; }
private function renderInlineComments() { if (!$this->inlines) { return null; } $inlines = $this->inlines; $changesets = $this->changesets; $inlines_by_changeset = mgroup($inlines, 'getChangesetID'); $inlines_by_changeset = array_select_keys($inlines_by_changeset, array_keys($this->changesets)); $view = new PhabricatorInlineSummaryView(); foreach ($inlines_by_changeset as $changeset_id => $inlines) { $changeset = $changesets[$changeset_id]; $items = array(); foreach ($inlines as $inline) { $on_target = $this->target && $this->target->getID() == $changeset->getDiffID(); $is_visible = false; if ($inline->getIsNewFile()) { // This comment is on the right side of the versus diff, and visible // on the left side of the page. if ($this->versusDiffID) { if ($changeset->getDiffID() == $this->versusDiffID) { $is_visible = true; } } // This comment is on the right side of the target diff, and visible // on the right side of the page. if ($on_target) { $is_visible = true; } } else { // Ths comment is on the left side of the target diff, and visible // on the left side of the page. if (!$this->versusDiffID) { if ($on_target) { $is_visible = true; } } // TODO: We still get one edge case wrong here, when we have a // versus diff and the file didn't exist in the old version. The // comment is visible because we show the left side of the target // diff when there's no corresponding file in the versus diff, but // we incorrectly link it off-page. } $item = array('id' => $inline->getID(), 'line' => $inline->getLineNumber(), 'length' => $inline->getLineLength(), 'content' => PhabricatorInlineSummaryView::renderCommentContent($inline, $this->markupEngine)); if (!$is_visible) { $diff_id = $changeset->getDiffID(); $item['where'] = '(On Diff #' . $diff_id . ')'; $item['href'] = 'D' . $this->comment->getRevisionID() . '?id=' . $diff_id . '&large=true' . '#inline-' . $inline->getID(); } $items[] = $item; } $view->addCommentGroup($changeset->getFilename(), $items); } return $view; }