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:
@@ -32,9 +32,18 @@ class DiffusionChangeController extends DiffusionController {
|
||||
}
|
||||
|
||||
$changeset_view = new DifferentialChangesetListView();
|
||||
$changeset_view->setChangesets(array($changeset));
|
||||
$changeset_view->setChangesets(
|
||||
array(
|
||||
0 => $changeset,
|
||||
));
|
||||
$changeset_view->setRenderingReferences(
|
||||
array(
|
||||
0 => $diff_query->getRenderingReference(),
|
||||
));
|
||||
$changeset_view->setRenderURI(
|
||||
'/diffusion/'.$drequest->getRepository()->getCallsign().'/diff/');
|
||||
$changeset_view->setWhitespace(
|
||||
DifferentialChangesetParser::WHITESPACE_SHOW_ALL);
|
||||
|
||||
$content[] = $this->buildCrumbs(
|
||||
array(
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
|
||||
|
||||
phutil_require_module('phabricator', 'aphront/response/404');
|
||||
phutil_require_module('phabricator', 'applications/differential/parser/changeset');
|
||||
phutil_require_module('phabricator', 'applications/differential/view/changesetlistview');
|
||||
phutil_require_module('phabricator', 'applications/diffusion/controller/base');
|
||||
phutil_require_module('phabricator', 'applications/diffusion/query/diff/base');
|
||||
|
||||
@@ -146,6 +146,7 @@ class DiffusionCommitController extends DiffusionController {
|
||||
throw new Exception("Unknown VCS.");
|
||||
}
|
||||
|
||||
$references = array();
|
||||
foreach ($changesets as $key => $changeset) {
|
||||
$file_type = $changeset->getFileType();
|
||||
if ($file_type == DifferentialChangeType::FILE_DIRECTORY) {
|
||||
@@ -160,11 +161,12 @@ class DiffusionCommitController extends DiffusionController {
|
||||
$filename = $changeset->getFilename();
|
||||
$commit = $drequest->getCommit();
|
||||
$reference = "{$branch}{$filename};{$commit}";
|
||||
$changeset->setRenderingReference($reference);
|
||||
$references[$key] = $reference;
|
||||
}
|
||||
|
||||
$change_list = new DifferentialChangesetListView();
|
||||
$change_list->setChangesets($changesets);
|
||||
$change_list->setRenderingReferences($references);
|
||||
$change_list->setRenderURI('/diffusion/'.$callsign.'/diff/');
|
||||
|
||||
// TODO: This is pretty awkward, unify the CSS between Diffusion and
|
||||
|
||||
@@ -20,8 +20,8 @@ class DiffusionDiffController extends DiffusionController {
|
||||
|
||||
public function willProcessRequest(array $data) {
|
||||
$request = $this->getRequest();
|
||||
if ($request->getStr('id')) {
|
||||
$parts = explode(';', $request->getStr('id'));
|
||||
if ($request->getStr('ref')) {
|
||||
$parts = explode(';', $request->getStr('ref'));
|
||||
$data['path'] = idx($parts, 0);
|
||||
$data['commit'] = idx($parts, 1);
|
||||
}
|
||||
@@ -43,6 +43,7 @@ class DiffusionDiffController extends DiffusionController {
|
||||
|
||||
$parser = new DifferentialChangesetParser();
|
||||
$parser->setChangeset($changeset);
|
||||
$parser->setRenderingReference($diff_query->getRenderingReference());
|
||||
$parser->setWhitespaceMode(
|
||||
DifferentialChangesetParser::WHITESPACE_SHOW_ALL);
|
||||
|
||||
|
||||
@@ -27,7 +27,7 @@ class DiffusionLastModifiedController extends DiffusionController {
|
||||
list($commit, $commit_data) = $modified_query->loadLastModification();
|
||||
|
||||
$phids = array();
|
||||
if ($commit_data->getCommitDetail('authorPHID')) {
|
||||
if ($commit_data && $commit_data->getCommitDetail('authorPHID')) {
|
||||
$phids = array($commit_data->getCommitDetail('authorPHID'));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user