diff --git a/src/applications/differential/controller/DifferentialChangesetViewController.php b/src/applications/differential/controller/DifferentialChangesetViewController.php index 774f33d2f7..01a1ff6de6 100644 --- a/src/applications/differential/controller/DifferentialChangesetViewController.php +++ b/src/applications/differential/controller/DifferentialChangesetViewController.php @@ -368,8 +368,10 @@ final class DifferentialChangesetViewController extends DifferentialController { if ($changeset_id >= $first_new_id) { $name_map = $name_map_new; + $is_new = true; } else { $name_map = $name_map_old; + $is_new = false; } $filename = $changeset->getFilename(); @@ -377,6 +379,15 @@ final class DifferentialChangesetViewController extends DifferentialController { // This changeset is on a file with the same name as the current // changeset, so we're going to port it forward or backward. $target_id = $name_map[$filename]; + if ($is_new) { + $reason = pht( + 'This comment was made on a file with the same name, but '. + 'in a newer diff.'); + } else { + $reason = pht( + 'This comment was made on a file with the same name, but '. + 'in an older diff.'); + } } // If we found a changeset to port this comment to, bring it forward @@ -385,7 +396,11 @@ final class DifferentialChangesetViewController extends DifferentialController { $inline ->makeEphemeral(true) ->setChangesetID($target_id) - ->setIsGhost(true); + ->setIsGhost( + array( + 'new' => $is_new, + 'reason' => $reason, + )); $results[] = $inline; } diff --git a/src/infrastructure/diff/view/PHUIDiffInlineCommentDetailView.php b/src/infrastructure/diff/view/PHUIDiffInlineCommentDetailView.php index e0b147d68d..7c1b23594b 100644 --- a/src/infrastructure/diff/view/PHUIDiffInlineCommentDetailView.php +++ b/src/infrastructure/diff/view/PHUIDiffInlineCommentDetailView.php @@ -123,14 +123,25 @@ final class PHUIDiffInlineCommentDetailView } $ghost_tag = null; - if ($inline->getIsGhost()) { - // TODO: This could also be a newer comment, not necessarily an older - // comment. + $ghost = $inline->getIsGhost(); + if ($ghost) { + if ($ghost['new']) { + $ghost_text = pht('Newer Comment'); + } else { + $ghost_text = pht('Older Comment'); + } + $ghost_tag = id(new PHUITagView()) ->setType(PHUITagView::TYPE_SHADE) - ->setName(pht('Old Comment')) + ->setName($ghost_text) ->setSlimShady(true) ->setShade(PHUITagView::COLOR_BLUE) + ->addSigil('has-tooltip') + ->setMetadata( + array( + 'tip' => $ghost['reason'], + 'size' => 300, + )) ->addClass('mml'); $classes[] = 'inline-comment-ghost'; }