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
This commit is contained in:
epriestley
2018-03-02 17:26:11 -08:00
parent 42e5b8a04b
commit 5844952153

View File

@@ -390,10 +390,20 @@ final class DifferentialChangesetViewController extends DifferentialController {
return array(); 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()) $template = id(new DifferentialInlineComment())
->setChangesetID($changeset->getID()) ->setChangesetID($changeset->getID())
->setIsNewFile(1) ->setIsNewFile($is_new)
->setLineLength(0); ->setLineLength(0);
$inlines = array(); $inlines = array();
foreach ($messages as $message) { foreach ($messages as $message) {