2011-03-14 06:03:30 +01:00
|
|
|
<?php
|
|
|
|
|
|
|
|
/*
|
2012-01-16 20:08:54 +01:00
|
|
|
* Copyright 2012 Facebook, Inc.
|
2011-03-14 06:03:30 +01:00
|
|
|
*
|
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
* you may not use this file except in compliance with the License.
|
|
|
|
* You may obtain a copy of the License at
|
|
|
|
*
|
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
*
|
|
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
* See the License for the specific language governing permissions and
|
|
|
|
* limitations under the License.
|
|
|
|
*/
|
|
|
|
|
2012-03-10 00:46:25 +01:00
|
|
|
final class DiffusionChangeController extends DiffusionController {
|
2011-03-14 06:03:30 +01:00
|
|
|
|
|
|
|
public function processRequest() {
|
|
|
|
$drequest = $this->diffusionRequest;
|
|
|
|
|
|
|
|
$content = array();
|
|
|
|
|
2011-03-31 02:36:16 +02:00
|
|
|
$diff_query = DiffusionDiffQuery::newFromDiffusionRequest($drequest);
|
|
|
|
$changeset = $diff_query->loadChangeset();
|
2011-03-14 06:03:30 +01:00
|
|
|
|
2011-04-06 21:27:56 +02:00
|
|
|
if (!$changeset) {
|
|
|
|
// TODO: Refine this.
|
|
|
|
return new Aphront404Response();
|
|
|
|
}
|
|
|
|
|
2012-05-02 22:13:03 +02:00
|
|
|
$callsign = $drequest->getRepository()->getCallsign();
|
2012-05-01 21:09:50 +02:00
|
|
|
$changesets = array(
|
|
|
|
0 => $changeset,
|
|
|
|
);
|
2012-05-02 22:13:03 +02:00
|
|
|
|
2011-03-31 02:36:16 +02:00
|
|
|
$changeset_view = new DifferentialChangesetListView();
|
2012-05-01 21:09:50 +02:00
|
|
|
$changeset_view->setChangesets($changesets);
|
|
|
|
$changeset_view->setVisibleChangesets($changesets);
|
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
2011-05-12 06:46:29 +02:00
|
|
|
$changeset_view->setRenderingReferences(
|
|
|
|
array(
|
|
|
|
0 => $diff_query->getRenderingReference(),
|
|
|
|
));
|
2012-05-02 22:13:03 +02:00
|
|
|
|
|
|
|
$raw_params = array(
|
|
|
|
'action' => 'browse',
|
|
|
|
'params' => array(
|
|
|
|
'view' => 'raw',
|
|
|
|
),
|
|
|
|
);
|
|
|
|
$right_uri = $drequest->generateURI($raw_params);
|
|
|
|
$raw_params['params']['before'] = $drequest->getRawCommit();
|
|
|
|
$left_uri = $drequest->generateURI($raw_params);
|
|
|
|
$changeset_view->setRawFileURIs($left_uri, $right_uri);
|
|
|
|
|
2011-03-31 02:36:16 +02:00
|
|
|
$changeset_view->setRenderURI(
|
2012-05-02 22:13:03 +02:00
|
|
|
'/diffusion/'.$callsign.'/diff/');
|
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
2011-05-12 06:46:29 +02:00
|
|
|
$changeset_view->setWhitespace(
|
|
|
|
DifferentialChangesetParser::WHITESPACE_SHOW_ALL);
|
2012-01-16 20:08:54 +01:00
|
|
|
$changeset_view->setUser($this->getRequest()->getUser());
|
2011-03-14 06:03:30 +01:00
|
|
|
|
2011-04-03 02:11:51 +02:00
|
|
|
$content[] = $this->buildCrumbs(
|
|
|
|
array(
|
|
|
|
'branch' => true,
|
|
|
|
'path' => true,
|
|
|
|
'view' => 'change',
|
|
|
|
));
|
|
|
|
|
2011-03-31 02:36:16 +02:00
|
|
|
// TODO: This is pretty awkward, unify the CSS between Diffusion and
|
|
|
|
// Differential better.
|
|
|
|
require_celerity_resource('differential-core-view-css');
|
|
|
|
$content[] =
|
|
|
|
'<div class="differential-primary-pane">'.
|
|
|
|
$changeset_view->render().
|
|
|
|
'</div>';
|
2011-03-14 06:03:30 +01:00
|
|
|
|
|
|
|
$nav = $this->buildSideNav('change', true);
|
|
|
|
$nav->appendChild($content);
|
|
|
|
|
|
|
|
return $this->buildStandardPageResponse(
|
|
|
|
$nav,
|
|
|
|
array(
|
|
|
|
'title' => 'Change',
|
|
|
|
));
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|