Differential D17054 Diff 41023 src/applications/differential/controller/DifferentialDiffViewController.php
Changeset View
Changeset View
Standalone View
Standalone View
src/applications/differential/controller/DifferentialDiffViewController.php
| Show All 17 Lines | if (!$diff) { | ||||
| return new Aphront404Response(); | return new Aphront404Response(); | ||||
| } | } | ||||
| if ($diff->getRevisionID()) { | if ($diff->getRevisionID()) { | ||||
| return id(new AphrontRedirectResponse()) | return id(new AphrontRedirectResponse()) | ||||
| ->setURI('/D'.$diff->getRevisionID().'?id='.$diff->getID()); | ->setURI('/D'.$diff->getRevisionID().'?id='.$diff->getID()); | ||||
| } | } | ||||
| if ($request->isFormPost()) { | |||||
| $diff_id = $diff->getID(); | |||||
| $revision_id = $request->getInt('revisionID'); | |||||
| if ($revision_id) { | |||||
| $attach_uri = "/revision/attach/{$diff_id}/to/{$revision_id}/"; | |||||
| } else { | |||||
| $attach_uri = "/revision/attach/{$diff_id}/to/"; | |||||
| } | |||||
| $attach_uri = $this->getApplicationURI($attach_uri); | |||||
| return id(new AphrontRedirectResponse()) | |||||
| ->setURI($attach_uri); | |||||
| } | |||||
| $diff_phid = $diff->getPHID(); | $diff_phid = $diff->getPHID(); | ||||
| $buildables = id(new HarbormasterBuildableQuery()) | $buildables = id(new HarbormasterBuildableQuery()) | ||||
| ->setViewer($viewer) | ->setViewer($viewer) | ||||
| ->withBuildablePHIDs(array($diff_phid)) | ->withBuildablePHIDs(array($diff_phid)) | ||||
| ->withManualBuildables(false) | ->withManualBuildables(false) | ||||
| ->needBuilds(true) | ->needBuilds(true) | ||||
| ->needTargets(true) | ->needTargets(true) | ||||
| ->execute(); | ->execute(); | ||||
| Show All 39 Lines | public function handleRequest(AphrontRequest $request) { | ||||
| } | } | ||||
| $select = phutil_tag( | $select = phutil_tag( | ||||
| 'select', | 'select', | ||||
| array('name' => 'revisionID'), | array('name' => 'revisionID'), | ||||
| $select); | $select); | ||||
| $form = id(new AphrontFormView()) | $form = id(new AphrontFormView()) | ||||
| ->setUser($request->getUser()) | ->setViewer($viewer) | ||||
| ->setAction('/differential/revision/edit/') | |||||
| ->addHiddenInput('diffID', $diff->getID()) | |||||
| ->addHiddenInput('viaDiffView', 1) | |||||
| ->addHiddenInput( | |||||
| id(new DifferentialRepositoryField())->getFieldKey(), | |||||
| $diff->getRepositoryPHID()) | |||||
| ->appendRemarkupInstructions( | ->appendRemarkupInstructions( | ||||
| pht( | pht( | ||||
| 'Review the diff for correctness. When you are satisfied, either '. | 'Review the diff for correctness. When you are satisfied, either '. | ||||
| '**create a new revision** or **update an existing revision**.')) | '**create a new revision** or **update an existing revision**.')) | ||||
| ->appendChild( | ->appendChild( | ||||
| id(new AphrontFormMarkupControl()) | id(new AphrontFormMarkupControl()) | ||||
| ->setLabel(pht('Attach To')) | ->setLabel(pht('Attach To')) | ||||
| ->setValue($select)) | ->setValue($select)) | ||||
| ->appendChild( | ->appendChild( | ||||
| id(new AphrontFormSubmitControl()) | id(new AphrontFormSubmitControl()) | ||||
| ->setValue(pht('Continue'))); | ->setValue(pht('Continue'))); | ||||
| $props = id(new DifferentialDiffProperty())->loadAllWhere( | $props = id(new DifferentialDiffProperty())->loadAllWhere( | ||||
| 'diffID = %d', | 'diffID = %d', | ||||
| $diff->getID()); | $diff->getID()); | ||||
| $props = mpull($props, 'getData', 'getName'); | $props = mpull($props, 'getData', 'getName'); | ||||
| $property_head = id(new PHUIHeaderView()) | $property_head = id(new PHUIHeaderView()) | ||||
| ->setHeader(pht('Properties')); | ->setHeader(pht('Properties')); | ||||
| $property_view = new PHUIPropertyListView(); | $property_view = new PHUIPropertyListView(); | ||||
| ▲ Show 20 Lines • Show All 97 Lines • Show Last 20 Lines | |||||