From 584495215301bf9fa94cc09b3f53469efff8c979 Mon Sep 17 00:00:00 2001 From: epriestley Date: Fri, 2 Mar 2018 17:26:11 -0800 Subject: [PATCH] Show lint messages in deleted files on the left-hand side of the change Summary: See PHI416. If you raise a lint message in a deleted file, we don't render any text on the right hand side so the message never displays. This is occasionally still legitimate/useful, e.g. to display a "don't delete this file" message. At least for now, show these messages on the left. Test Plan: Posted a lint message on a deleted file via `harbormaster.sendmessage`, viewed revision, saw file expand with synthetic inline for lint. Differential Revision: https://secure.phabricator.com/D19171 --- .../DifferentialChangesetViewController.php | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/src/applications/differential/controller/DifferentialChangesetViewController.php b/src/applications/differential/controller/DifferentialChangesetViewController.php index c2bd4bf8de..9d02202f9f 100644 --- a/src/applications/differential/controller/DifferentialChangesetViewController.php +++ b/src/applications/differential/controller/DifferentialChangesetViewController.php @@ -390,10 +390,20 @@ final class DifferentialChangesetViewController extends DifferentialController { return array(); } + $change_type = $changeset->getChangeType(); + if (DifferentialChangeType::isDeleteChangeType($change_type)) { + // If this is a lint message on a deleted file, show it on the left + // side of the UI because there are no source code lines on the right + // side of the UI so inlines don't have anywhere to render. See PHI416. + $is_new = 0; + } else { + $is_new = 1; + } + $template = id(new DifferentialInlineComment()) - ->setChangesetID($changeset->getID()) - ->setIsNewFile(1) - ->setLineLength(0); + ->setChangesetID($changeset->getID()) + ->setIsNewFile($is_new) + ->setLineLength(0); $inlines = array(); foreach ($messages as $message) {