Move "Rendering References" to the DifferentialChangesetParser level
Summary: Separates changeset IDs from rendering. Now each changeset has a "rendering reference" which is basically a description of what the ajax endpoint should render. For Differential, it's in the form "id/vs". For Diffusion, "branch/path;commit". I believe this fixes pretty much all of the bugs related to "show more" breaking in various obscure ways, although I never got a great repro for T153. Test Plan: Clicked "show more" in diffusion change and commit views and differential diff, diff-of-diff, standalone-diff, standalone-diff-of-diff views. Verified refs and 'whitespace' were always sent correctly. Made inline comments on diffs and diffs-of-diffs. Used "Reply". Reviewed By: tuomaspelkonen Reviewers: tuomaspelkonen, jungejason, aran CC: aran, tuomaspelkonen, epriestley Differential Revision: 274
This commit is contained in:
@@ -28,7 +28,6 @@ class DifferentialChangesetParser {
|
||||
|
||||
protected $filename = null;
|
||||
protected $filetype = null;
|
||||
protected $changesetID = null;
|
||||
protected $missingOld = array();
|
||||
protected $missingNew = array();
|
||||
|
||||
@@ -52,6 +51,8 @@ class DifferentialChangesetParser {
|
||||
private $rightSideChangesetID;
|
||||
private $rightSideAttachesToNewFile;
|
||||
|
||||
private $renderingReference;
|
||||
|
||||
const CACHE_VERSION = 4;
|
||||
|
||||
const ATTR_GENERATED = 'attr:generated';
|
||||
@@ -123,9 +124,7 @@ class DifferentialChangesetParser {
|
||||
|
||||
public function setChangeset($changeset) {
|
||||
$this->changeset = $changeset;
|
||||
|
||||
$this->setFilename($changeset->getFilename());
|
||||
$this->setChangesetID($changeset->getID());
|
||||
|
||||
return $this;
|
||||
}
|
||||
@@ -135,8 +134,8 @@ class DifferentialChangesetParser {
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function setChangesetID($changeset_id) {
|
||||
$this->changesetID = $changeset_id;
|
||||
public function setRenderingReference($ref) {
|
||||
$this->renderingReference = $ref;
|
||||
return $this;
|
||||
}
|
||||
|
||||
@@ -144,10 +143,6 @@ class DifferentialChangesetParser {
|
||||
return $this->changeset;
|
||||
}
|
||||
|
||||
public function getChangesetID() {
|
||||
return $this->changesetID;
|
||||
}
|
||||
|
||||
public function setFilename($filename) {
|
||||
$this->filename = $filename;
|
||||
if (strpos($filename, '.', 1) !== false) {
|
||||
@@ -968,7 +963,7 @@ EOSYNTHETIC;
|
||||
|
||||
if ($more) {
|
||||
$end = $this->getLength();
|
||||
$reference = $this->getChangeset()->getRenderingReference();
|
||||
$reference = $this->renderingReference;
|
||||
$more =
|
||||
' '.
|
||||
javelin_render_tag(
|
||||
@@ -979,8 +974,8 @@ EOSYNTHETIC;
|
||||
'class' => 'complete',
|
||||
'href' => '#',
|
||||
'meta' => array(
|
||||
'id' => $reference,
|
||||
'range' => "0-{$end}",
|
||||
'ref' => $reference,
|
||||
'range' => "0-{$end}",
|
||||
),
|
||||
),
|
||||
'Show File Contents');
|
||||
@@ -1073,7 +1068,7 @@ EOSYNTHETIC;
|
||||
|
||||
$gaps = array_reverse($gaps);
|
||||
|
||||
$reference = $this->getChangeset()->getRenderingReference();
|
||||
$reference = $this->renderingReference;
|
||||
|
||||
$left_id = $this->leftSideChangesetID;
|
||||
$right_id = $this->rightSideChangesetID;
|
||||
@@ -1112,7 +1107,7 @@ EOSYNTHETIC;
|
||||
'mustcapture' => true,
|
||||
'sigil' => 'show-more',
|
||||
'meta' => array(
|
||||
'id' => $reference,
|
||||
'ref' => $reference,
|
||||
'range' => "{$top}-{$len}/{$top}-20",
|
||||
),
|
||||
),
|
||||
@@ -1126,7 +1121,7 @@ EOSYNTHETIC;
|
||||
'mustcapture' => true,
|
||||
'sigil' => 'show-more',
|
||||
'meta' => array(
|
||||
'id' => $reference,
|
||||
'ref' => $reference,
|
||||
'range' => "{$top}-{$len}/{$top}-{$len}",
|
||||
),
|
||||
),
|
||||
@@ -1140,7 +1135,7 @@ EOSYNTHETIC;
|
||||
'mustcapture' => true,
|
||||
'sigil' => 'show-more',
|
||||
'meta' => array(
|
||||
'id' => $reference,
|
||||
'ref' => $reference,
|
||||
'range' => "{$top}-{$len}/{$end}-20",
|
||||
),
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user