@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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

+76 -75
+59 -66
src/applications/differential/controller/DifferentialDiffViewController.php
··· 24 24 return new Aphront404Response(); 25 25 } 26 26 27 + if ($diff->getRevisionID()) { 28 + return id(new AphrontRedirectResponse()) 29 + ->setURI('/D'.$diff->getRevisionID().'?id='.$diff->getID()); 30 + } 31 + 27 32 $error_view = id(new PHUIErrorView()) 28 33 ->setSeverity(PHUIErrorView::SEVERITY_NOTICE); 29 - if ($diff->getRevisionID()) { 30 - $error_view->appendChild( 31 - pht( 32 - 'This diff belongs to revision %s.', 33 - phutil_tag( 34 - 'a', 35 - array( 36 - 'href' => '/D'.$diff->getRevisionID(), 37 - ), 38 - 'D'.$diff->getRevisionID()))); 39 - } else { 40 - // TODO: implement optgroup support in AphrontFormSelectControl? 41 - $select = array(); 42 - $select[] = hsprintf('<optgroup label="%s">', pht('Create New Revision')); 43 - $select[] = phutil_tag( 44 - 'option', 45 - array('value' => ''), 46 - pht('Create a new Revision...')); 47 - $select[] = hsprintf('</optgroup>'); 34 + // TODO: implement optgroup support in AphrontFormSelectControl? 35 + $select = array(); 36 + $select[] = hsprintf('<optgroup label="%s">', pht('Create New Revision')); 37 + $select[] = phutil_tag( 38 + 'option', 39 + array('value' => ''), 40 + pht('Create a new Revision...')); 41 + $select[] = hsprintf('</optgroup>'); 48 42 49 - $revisions = id(new DifferentialRevisionQuery()) 50 - ->setViewer($viewer) 51 - ->withAuthors(array($viewer->getPHID())) 52 - ->withStatus(DifferentialRevisionQuery::STATUS_OPEN) 53 - ->execute(); 43 + $revisions = id(new DifferentialRevisionQuery()) 44 + ->setViewer($viewer) 45 + ->withAuthors(array($viewer->getPHID())) 46 + ->withStatus(DifferentialRevisionQuery::STATUS_OPEN) 47 + ->execute(); 54 48 55 - if ($revisions) { 56 - $select[] = hsprintf( 57 - '<optgroup label="%s">', 58 - pht('Update Existing Revision')); 59 - foreach ($revisions as $revision) { 60 - $select[] = phutil_tag( 61 - 'option', 62 - array( 63 - 'value' => $revision->getID(), 64 - ), 65 - id(new PhutilUTF8StringTruncator()) 66 - ->setMaximumGlyphs(128) 67 - ->truncateString( 68 - 'D'.$revision->getID().' '.$revision->getTitle())); 69 - } 70 - $select[] = hsprintf('</optgroup>'); 49 + if ($revisions) { 50 + $select[] = hsprintf( 51 + '<optgroup label="%s">', 52 + pht('Update Existing Revision')); 53 + foreach ($revisions as $revision) { 54 + $select[] = phutil_tag( 55 + 'option', 56 + array( 57 + 'value' => $revision->getID(), 58 + ), 59 + id(new PhutilUTF8StringTruncator()) 60 + ->setMaximumGlyphs(128) 61 + ->truncateString( 62 + 'D'.$revision->getID().' '.$revision->getTitle())); 71 63 } 64 + $select[] = hsprintf('</optgroup>'); 65 + } 72 66 73 - $select = phutil_tag( 74 - 'select', 75 - array('name' => 'revisionID'), 76 - $select); 67 + $select = phutil_tag( 68 + 'select', 69 + array('name' => 'revisionID'), 70 + $select); 77 71 78 - $form = id(new AphrontFormView()) 79 - ->setUser($request->getUser()) 80 - ->setAction('/differential/revision/edit/') 81 - ->addHiddenInput('diffID', $diff->getID()) 82 - ->addHiddenInput('viaDiffView', 1) 83 - ->addHiddenInput( 84 - id(new DifferentialRepositoryField())->getFieldKey(), 85 - $diff->getRepositoryPHID()) 86 - ->appendRemarkupInstructions( 87 - pht( 88 - 'Review the diff for correctness. When you are satisfied, either '. 89 - '**create a new revision** or **update an existing revision**.')) 90 - ->appendChild( 91 - id(new AphrontFormMarkupControl()) 92 - ->setLabel(pht('Attach To')) 93 - ->setValue($select)) 94 - ->appendChild( 95 - id(new AphrontFormSubmitControl()) 96 - ->setValue(pht('Continue'))); 72 + $form = id(new AphrontFormView()) 73 + ->setUser($request->getUser()) 74 + ->setAction('/differential/revision/edit/') 75 + ->addHiddenInput('diffID', $diff->getID()) 76 + ->addHiddenInput('viaDiffView', 1) 77 + ->addHiddenInput( 78 + id(new DifferentialRepositoryField())->getFieldKey(), 79 + $diff->getRepositoryPHID()) 80 + ->appendRemarkupInstructions( 81 + pht( 82 + 'Review the diff for correctness. When you are satisfied, either '. 83 + '**create a new revision** or **update an existing revision**.')) 84 + ->appendChild( 85 + id(new AphrontFormMarkupControl()) 86 + ->setLabel(pht('Attach To')) 87 + ->setValue($select)) 88 + ->appendChild( 89 + id(new AphrontFormSubmitControl()) 90 + ->setValue(pht('Continue'))); 97 91 98 - $error_view->appendChild($form); 99 - } 92 + $error_view->appendChild($form); 100 93 101 94 $props = id(new DifferentialDiffProperty())->loadAllWhere( 102 - 'diffID = %d', 95 + 'diffID = %d', 103 96 $diff->getID()); 104 97 $props = mpull($props, 'getData', 'getName'); 105 98
+16 -6
src/applications/differential/view/DifferentialRevisionUpdateHistoryView.php
··· 62 62 } 63 63 64 64 $max_id = $diff->getID(); 65 + $revision_id = $diff->getRevisionID(); 65 66 66 67 $idx = 0; 67 68 $rows = array(); ··· 169 170 } 170 171 $last_base = $base; 171 172 172 - $id_link = phutil_tag( 173 - 'a', 174 - array( 175 - 'href' => '/differential/diff/'.$id.'/', 176 - ), 177 - $id); 173 + if ($revision_id) { 174 + $id_link = phutil_tag( 175 + 'a', 176 + array( 177 + 'href' => '/D'.$revision_id.'?id='.$id, 178 + ), 179 + $id); 180 + } else { 181 + $id_link = phutil_tag( 182 + 'a', 183 + array( 184 + 'href' => '/differential/diff/'.$id.'/', 185 + ), 186 + $id); 187 + } 178 188 179 189 $rows[] = array( 180 190 $name,
+1 -3
src/applications/differential/view/DifferentialTransactionView.php
··· 143 143 144 144 $is_visible = ($changeset_diff_id == $visible_diff_id); 145 145 if (!$is_visible) { 146 - $item['where'] = pht('(On Diff #%d)', $changeset_diff_id); 147 - 148 146 $revision_id = $this->getRevision()->getID(); 149 147 $comment_id = $comment->getID(); 150 - 151 148 $item['href'] = 152 149 '/D'.$revision_id. 153 150 '?id='.$changeset_diff_id. 154 151 '#inline-'.$comment_id; 152 + $item['where'] = pht('(On Diff #%d)', $changeset_diff_id); 155 153 } 156 154 157 155 $items[] = $item;