1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-20 12:30:56 +01:00

Always run "behavior-populate" before "behavior-show-more"

Summary:
Ref T2009. This clears the stage for D11977.

Specifically, D11977 moves "show context" logic into ChangesetViewManager, but those objects won't exist if we don't run "behavior-populate" first.

Generally, this increases consistency across changeset views -- which is still very low overall, but getting slightly better.

Both of these should probably move up more and use ChangesetListView, but we don't need to do that quite yet.

Test Plan:
  - Took changeset actions in Phriction diff view.
  - Took changeset actions in Differential standalone view.
  - Took changeset actions in normal Differential view.

Reviewers: btrahan

Reviewed By: btrahan

Subscribers: epriestley

Maniphest Tasks: T2009

Differential Revision: https://secure.phabricator.com/D11978
This commit is contained in:
epriestley 2015-03-05 14:02:45 -08:00
parent 06df75ebbd
commit df661eca35
2 changed files with 23 additions and 8 deletions

View file

@ -162,7 +162,6 @@ final class DifferentialChangesetViewController extends DifferentialController {
$parser->setRenderer(new DifferentialChangesetOneUpRenderer());
}
if ($left && $right) {
$parser->setOriginals($left, $right);
}
@ -229,13 +228,6 @@ final class DifferentialChangesetViewController extends DifferentialController {
->setCoverage($coverage);
}
Javelin::initBehavior('differential-show-more', array(
'uri' => '/differential/changeset/',
'whitespace' => $request->getStr('whitespace'),
));
Javelin::initBehavior('differential-comment-jump', array());
// TODO: [HTML] Clean up DifferentialChangesetParser output, but it's
// undergoing like six kinds of refactoring anyway.
$output = phutil_safe_html($output);
@ -246,6 +238,17 @@ final class DifferentialChangesetViewController extends DifferentialController {
->appendChild($output)
->setVsChangesetID($left_source);
Javelin::initBehavior('differential-populate', array(
'changesetViewIDs' => array($detail->getID()),
));
Javelin::initBehavior('differential-show-more', array(
'uri' => '/differential/changeset/',
'whitespace' => $request->getStr('whitespace'),
));
Javelin::initBehavior('differential-comment-jump', array());
$panel = new DifferentialPrimaryPaneView();
$panel->appendChild(
phutil_tag(

View file

@ -59,6 +59,8 @@ final class PhrictionDiffController extends PhrictionController {
$engine = new PhabricatorDifferenceEngine();
$changeset = $engine->generateChangesetFromFileContent($text_l, $text_r);
$changeset->setFilename($content_r->getTitle());
$changeset->setOldProperties(
array(
'Title' => $content_l->getTitle(),
@ -84,6 +86,7 @@ final class PhrictionDiffController extends PhrictionController {
$spec = $request->getStr('range');
list($range_s, $range_e, $mask) =
DifferentialChangesetParser::parseRangeSpecification($spec);
$output = $parser->render($range_s, $range_e, $mask);
if ($request->isAjax()) {
@ -91,10 +94,19 @@ final class PhrictionDiffController extends PhrictionController {
->setRenderedChangeset($output);
}
$output = id(new DifferentialChangesetDetailView())
->setUser($this->getViewer())
->setChangeset($changeset)
->appendChild($output);
require_celerity_resource('differential-changeset-view-css');
require_celerity_resource('syntax-highlighting-css');
require_celerity_resource('phriction-document-css');
Javelin::initBehavior('differential-populate', array(
'changesetViewIDs' => array($output->getID()),
));
Javelin::initBehavior('differential-show-more', array(
'uri' => '/phriction/diff/'.$document->getID().'/',
'whitespace' => $whitespace_mode,