mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-10 00:42:41 +01:00
Differential - make sure not to return change type header if we're not top level
Summary: Followup to D6924. Fixes T3824. Test Plan: deleted a file in a diff. was able to view file content without JS errors Reviewers: epriestley Reviewed By: epriestley CC: Korvin, aran Maniphest Tasks: T3824 Differential Revision: https://secure.phabricator.com/D6963
This commit is contained in:
parent
35611f71f6
commit
ab2ae9e47f
2 changed files with 16 additions and 4 deletions
|
@ -665,8 +665,7 @@ final class DifferentialChangesetParser {
|
|||
if ($changeset->getChangeType() == DifferentialChangeType::TYPE_DELETE &&
|
||||
$old == array('unix:filemode' => '100644')) {
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -691,6 +690,7 @@ final class DifferentialChangesetParser {
|
|||
$renderer = $this->getRenderer()
|
||||
->setChangeset($this->changeset)
|
||||
->setRenderPropertyChangeHeader($render_pch)
|
||||
->setIsTopLevel($this->isTopLevel)
|
||||
->setOldRender($this->oldRender)
|
||||
->setNewRender($this->newRender)
|
||||
->setHunkStartLines($this->hunkStartLines)
|
||||
|
|
|
@ -6,6 +6,7 @@ abstract class DifferentialChangesetRenderer {
|
|||
private $changeset;
|
||||
private $renderingReference;
|
||||
private $renderPropertyChangeHeader;
|
||||
private $isTopLevel;
|
||||
private $hunkStartLines;
|
||||
private $oldLines;
|
||||
private $newLines;
|
||||
|
@ -236,14 +237,25 @@ abstract class DifferentialChangesetRenderer {
|
|||
return $this->renderPropertyChangeHeader;
|
||||
}
|
||||
|
||||
public function setIsTopLevel($is) {
|
||||
$this->isTopLevel = $is;
|
||||
return $this;
|
||||
}
|
||||
private function getIsTopLevel() {
|
||||
return $this->isTopLevel;
|
||||
}
|
||||
|
||||
final public function renderChangesetTable($content) {
|
||||
$props = null;
|
||||
if ($this->shouldRenderPropertyChangeHeader()) {
|
||||
$props = $this->renderPropertyChangeHeader();
|
||||
}
|
||||
|
||||
$force = (!$content && !$props);
|
||||
$notice = $this->renderChangeTypeHeader($force);
|
||||
$notice = null;
|
||||
if ($this->getIsTopLevel()) {
|
||||
$force = (!$content && !$props);
|
||||
$notice = $this->renderChangeTypeHeader($force);
|
||||
}
|
||||
|
||||
$result = $notice.$props.$content;
|
||||
|
||||
|
|
Loading…
Reference in a new issue