mirror of
https://we.phorge.it/source/phorge.git
synced 2025-01-22 12:41:19 +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 &&
|
if ($changeset->getChangeType() == DifferentialChangeType::TYPE_DELETE &&
|
||||||
$old == array('unix:filemode' => '100644')) {
|
$old == array('unix:filemode' => '100644')) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -691,6 +690,7 @@ final class DifferentialChangesetParser {
|
||||||
$renderer = $this->getRenderer()
|
$renderer = $this->getRenderer()
|
||||||
->setChangeset($this->changeset)
|
->setChangeset($this->changeset)
|
||||||
->setRenderPropertyChangeHeader($render_pch)
|
->setRenderPropertyChangeHeader($render_pch)
|
||||||
|
->setIsTopLevel($this->isTopLevel)
|
||||||
->setOldRender($this->oldRender)
|
->setOldRender($this->oldRender)
|
||||||
->setNewRender($this->newRender)
|
->setNewRender($this->newRender)
|
||||||
->setHunkStartLines($this->hunkStartLines)
|
->setHunkStartLines($this->hunkStartLines)
|
||||||
|
|
|
@ -6,6 +6,7 @@ abstract class DifferentialChangesetRenderer {
|
||||||
private $changeset;
|
private $changeset;
|
||||||
private $renderingReference;
|
private $renderingReference;
|
||||||
private $renderPropertyChangeHeader;
|
private $renderPropertyChangeHeader;
|
||||||
|
private $isTopLevel;
|
||||||
private $hunkStartLines;
|
private $hunkStartLines;
|
||||||
private $oldLines;
|
private $oldLines;
|
||||||
private $newLines;
|
private $newLines;
|
||||||
|
@ -236,14 +237,25 @@ abstract class DifferentialChangesetRenderer {
|
||||||
return $this->renderPropertyChangeHeader;
|
return $this->renderPropertyChangeHeader;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function setIsTopLevel($is) {
|
||||||
|
$this->isTopLevel = $is;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
private function getIsTopLevel() {
|
||||||
|
return $this->isTopLevel;
|
||||||
|
}
|
||||||
|
|
||||||
final public function renderChangesetTable($content) {
|
final public function renderChangesetTable($content) {
|
||||||
$props = null;
|
$props = null;
|
||||||
if ($this->shouldRenderPropertyChangeHeader()) {
|
if ($this->shouldRenderPropertyChangeHeader()) {
|
||||||
$props = $this->renderPropertyChangeHeader();
|
$props = $this->renderPropertyChangeHeader();
|
||||||
}
|
}
|
||||||
|
|
||||||
$force = (!$content && !$props);
|
$notice = null;
|
||||||
$notice = $this->renderChangeTypeHeader($force);
|
if ($this->getIsTopLevel()) {
|
||||||
|
$force = (!$content && !$props);
|
||||||
|
$notice = $this->renderChangeTypeHeader($force);
|
||||||
|
}
|
||||||
|
|
||||||
$result = $notice.$props.$content;
|
$result = $notice.$props.$content;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue