1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-30 10:42:41 +01:00

Display compatible inline comments (usually synthetic) on the same row

Summary:
This just looks silly:
{F8088, size=full}

It runs in O(N*N) but it's not a big deal because there are usually only few
comments per line.
I didn't implement it for images.

Test Plan:
View revision with compatible inline comments in two diffs.
View revision with different inline comments on same line in two diffs.

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, epriestley

Differential Revision: https://secure.phabricator.com/D1570
This commit is contained in:
vrana 2012-02-03 23:18:47 -08:00
parent 5e58a016a5
commit 6cb5db60d5
2 changed files with 19 additions and 1 deletions

View file

@ -1394,10 +1394,21 @@ class DifferentialChangesetParser {
if ($o_num && isset($old_comments[$o_num])) { if ($o_num && isset($old_comments[$o_num])) {
foreach ($old_comments[$o_num] as $comment) { foreach ($old_comments[$o_num] as $comment) {
$xhp = $this->renderInlineComment($comment); $xhp = $this->renderInlineComment($comment);
$new = '';
if ($n_num && isset($new_comments[$n_num])) {
foreach ($new_comments[$n_num] as $key => $new_comment) {
if ($comment->isCompatible($new_comment)) {
$new = $this->renderInlineComment($new_comment);
unset($new_comments[$n_num][$key]);
}
}
}
$html[] = $html[] =
'<tr class="inline"><th /><td>'. '<tr class="inline"><th /><td>'.
$xhp. $xhp.
'</td><th /><td /><td class="cov" /></tr>'; '</td><th /><td>'.
$new.
'</td><td class="cov" /></tr>';
} }
} }
if ($n_num && isset($new_comments[$n_num])) { if ($n_num && isset($new_comments[$n_num])) {

View file

@ -42,4 +42,11 @@ class DifferentialInlineComment extends DifferentialDAO {
return $this->syntheticAuthor; return $this->syntheticAuthor;
} }
public function isCompatible(DifferentialInlineComment $comment) {
return
$this->authorPHID === $comment->authorPHID &&
$this->syntheticAuthor === $comment->syntheticAuthor &&
$this->content === $comment->content;
}
} }