From 62bc3373e5a6e28246947b65ebf4e72475e52990 Mon Sep 17 00:00:00 2001 From: epriestley Date: Fri, 21 Dec 2012 14:16:00 -0800 Subject: [PATCH] Fix error with inline comments on images Summary: This data structure is a `dict>` now, where the `int` is the line number. Test Plan: - Created a diff changing an image. - Added inline comments on the left and right sides of the diff. - Saw some exceptions and general sadness. - Applied patch. - Reloaded page. - Everything worked great. Reviewers: btrahan Reviewed By: btrahan CC: aran Differential Revision: https://secure.phabricator.com/D4264 --- .../DifferentialChangesetTwoUpRenderer.php | 40 ++++++++++--------- 1 file changed, 22 insertions(+), 18 deletions(-) diff --git a/src/applications/differential/render/DifferentialChangesetTwoUpRenderer.php b/src/applications/differential/render/DifferentialChangesetTwoUpRenderer.php index 52dde106eb..5f25391421 100644 --- a/src/applications/differential/render/DifferentialChangesetTwoUpRenderer.php +++ b/src/applications/differential/render/DifferentialChangesetTwoUpRenderer.php @@ -403,25 +403,29 @@ final class DifferentialChangesetTwoUpRenderer $html_old = array(); $html_new = array(); - foreach ($this->getOldComments() as $comment) { - $comment_html = $this->renderInlineComment($comment, $on_right = false); - $html_old[] = - ''. - ''. - ''.$comment_html.''. - ''. - ''. - ''; + foreach ($this->getOldComments() as $on_line => $comment_group) { + foreach ($comment_group as $comment) { + $comment_html = $this->renderInlineComment($comment, $on_right = false); + $html_old[] = + ''. + ''. + ''.$comment_html.''. + ''. + ''. + ''; + } } - foreach ($this->getNewComments() as $comment) { - $comment_html = $this->renderInlineComment($comment, $on_right = true); - $html_new[] = - ''. - ''. - ''. - ''. - ''.$comment_html.''. - ''; + foreach ($this->getNewComments() as $lin_line => $comment_group) { + foreach ($comment_group as $comment) { + $comment_html = $this->renderInlineComment($comment, $on_right = true); + $html_new[] = + ''. + ''. + ''. + ''. + ''.$comment_html.''. + ''; + } } if (!$old) {