1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-09-20 09:18:48 +02:00

Differential - finesse Differential diff view controller

Summary:
Fixes T7229. Some usability issues around this controller - basically you can't leave comments with it and its not particular useful compared to the revision page.

Ergo, if there is a revision associated with a given diff, just re-direct back to the revision page with the proper diff loaded.

Test Plan: Tried to view a diff on the standalone controller attached to a revision and instead was re-directed to the revision view page with the proper diff loaded.

Reviewers: epriestley

Reviewed By: epriestley

Subscribers: Korvin, epriestley

Maniphest Tasks: T7229

Differential Revision: https://secure.phabricator.com/D11811
This commit is contained in:
Bob Trahan 2015-02-19 10:55:56 -08:00
parent f6915a7975
commit 1d72a5f683
3 changed files with 82 additions and 81 deletions

View file

@ -24,19 +24,13 @@ final class DifferentialDiffViewController extends DifferentialController {
return new Aphront404Response();
}
if ($diff->getRevisionID()) {
return id(new AphrontRedirectResponse())
->setURI('/D'.$diff->getRevisionID().'?id='.$diff->getID());
}
$error_view = id(new PHUIErrorView())
->setSeverity(PHUIErrorView::SEVERITY_NOTICE);
if ($diff->getRevisionID()) {
$error_view->appendChild(
pht(
'This diff belongs to revision %s.',
phutil_tag(
'a',
array(
'href' => '/D'.$diff->getRevisionID(),
),
'D'.$diff->getRevisionID())));
} else {
// TODO: implement optgroup support in AphrontFormSelectControl?
$select = array();
$select[] = hsprintf('<optgroup label="%s">', pht('Create New Revision'));
@ -96,7 +90,6 @@ final class DifferentialDiffViewController extends DifferentialController {
->setValue(pht('Continue')));
$error_view->appendChild($form);
}
$props = id(new DifferentialDiffProperty())->loadAllWhere(
'diffID = %d',

View file

@ -62,6 +62,7 @@ final class DifferentialRevisionUpdateHistoryView extends AphrontView {
}
$max_id = $diff->getID();
$revision_id = $diff->getRevisionID();
$idx = 0;
$rows = array();
@ -169,12 +170,21 @@ final class DifferentialRevisionUpdateHistoryView extends AphrontView {
}
$last_base = $base;
if ($revision_id) {
$id_link = phutil_tag(
'a',
array(
'href' => '/D'.$revision_id.'?id='.$id,
),
$id);
} else {
$id_link = phutil_tag(
'a',
array(
'href' => '/differential/diff/'.$id.'/',
),
$id);
}
$rows[] = array(
$name,

View file

@ -143,15 +143,13 @@ final class DifferentialTransactionView
$is_visible = ($changeset_diff_id == $visible_diff_id);
if (!$is_visible) {
$item['where'] = pht('(On Diff #%d)', $changeset_diff_id);
$revision_id = $this->getRevision()->getID();
$comment_id = $comment->getID();
$item['href'] =
'/D'.$revision_id.
'?id='.$changeset_diff_id.
'#inline-'.$comment_id;
$item['where'] = pht('(On Diff #%d)', $changeset_diff_id);
}
$items[] = $item;