1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-22 23:02:42 +01:00

Fix error with inline comments on images

Summary: This data structure is a `dict<int, list<Comment>>` 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
This commit is contained in:
epriestley 2012-12-21 14:16:00 -08:00
parent 394340fd8f
commit 62bc3373e5

View file

@ -403,7 +403,8 @@ final class DifferentialChangesetTwoUpRenderer
$html_old = array(); $html_old = array();
$html_new = array(); $html_new = array();
foreach ($this->getOldComments() as $comment) { foreach ($this->getOldComments() as $on_line => $comment_group) {
foreach ($comment_group as $comment) {
$comment_html = $this->renderInlineComment($comment, $on_right = false); $comment_html = $this->renderInlineComment($comment, $on_right = false);
$html_old[] = $html_old[] =
'<tr class="inline">'. '<tr class="inline">'.
@ -413,7 +414,9 @@ final class DifferentialChangesetTwoUpRenderer
'<td class="right3" colspan="3" />'. '<td class="right3" colspan="3" />'.
'</tr>'; '</tr>';
} }
foreach ($this->getNewComments() as $comment) { }
foreach ($this->getNewComments() as $lin_line => $comment_group) {
foreach ($comment_group as $comment) {
$comment_html = $this->renderInlineComment($comment, $on_right = true); $comment_html = $this->renderInlineComment($comment, $on_right = true);
$html_new[] = $html_new[] =
'<tr class="inline">'. '<tr class="inline">'.
@ -423,6 +426,7 @@ final class DifferentialChangesetTwoUpRenderer
'<td class="right3" colspan="3">'.$comment_html.'</td>'. '<td class="right3" colspan="3">'.$comment_html.'</td>'.
'</tr>'; '</tr>';
} }
}
if (!$old) { if (!$old) {
$th_old = '<th></th>'; $th_old = '<th></th>';