Differential D12224 Diff 29377 src/applications/diffusion/controller/DiffusionCommitEditController.php
Changeset View
Changeset View
Standalone View
Standalone View
src/applications/diffusion/controller/DiffusionCommitEditController.php
Show All 9 Lines | protected function processDiffusionRequest(AphrontRequest $request) { | ||||
$commit = $drequest->loadCommit(); | $commit = $drequest->loadCommit(); | ||||
$data = $commit->loadCommitData(); | $data = $commit->loadCommitData(); | ||||
$page_title = pht('Edit Diffusion Commit'); | $page_title = pht('Edit Diffusion Commit'); | ||||
if (!$commit) { | if (!$commit) { | ||||
return new Aphront404Response(); | return new Aphront404Response(); | ||||
} | } | ||||
$commit_phid = $commit->getPHID(); | $commit_phid = $commit->getPHID(); | ||||
$edge_type = PhabricatorProjectObjectHasProjectEdgeType::EDGECONST; | $edge_type = PhabricatorProjectObjectHasProjectEdgeType::EDGECONST; | ||||
$current_proj_phids = PhabricatorEdgeQuery::loadDestinationPHIDs( | $current_proj_phids = PhabricatorEdgeQuery::loadDestinationPHIDs( | ||||
$commit_phid, | $commit_phid, | ||||
$edge_type); | $edge_type); | ||||
$handles = $this->loadViewerHandles($current_proj_phids); | |||||
$proj_t_values = $handles; | |||||
if ($request->isFormPost()) { | if ($request->isFormPost()) { | ||||
$xactions = array(); | $xactions = array(); | ||||
$proj_phids = $request->getArr('projects'); | $proj_phids = $request->getArr('projects'); | ||||
$xactions[] = id(new PhabricatorAuditTransaction()) | $xactions[] = id(new PhabricatorAuditTransaction()) | ||||
->setTransactionType(PhabricatorTransactions::TYPE_EDGE) | ->setTransactionType(PhabricatorTransactions::TYPE_EDGE) | ||||
->setMetadataValue('edge:type', $edge_type) | ->setMetadataValue('edge:type', $edge_type) | ||||
->setNewValue(array('=' => array_fuse($proj_phids))); | ->setNewValue(array('=' => array_fuse($proj_phids))); | ||||
$editor = id(new PhabricatorAuditEditor()) | $editor = id(new PhabricatorAuditEditor()) | ||||
->setActor($user) | ->setActor($user) | ||||
->setContinueOnNoEffect(true) | ->setContinueOnNoEffect(true) | ||||
->setContentSourceFromRequest($request); | ->setContentSourceFromRequest($request); | ||||
$xactions = $editor->applyTransactions($commit, $xactions); | $xactions = $editor->applyTransactions($commit, $xactions); | ||||
return id(new AphrontRedirectResponse()) | return id(new AphrontRedirectResponse()) | ||||
->setURI('/r'.$callsign.$commit->getCommitIdentifier()); | ->setURI('/r'.$callsign.$commit->getCommitIdentifier()); | ||||
} | } | ||||
$tokenizer_id = celerity_generate_unique_node_id(); | $tokenizer_id = celerity_generate_unique_node_id(); | ||||
$form = id(new AphrontFormView()) | $form = id(new AphrontFormView()) | ||||
->setUser($user) | ->setUser($user) | ||||
->setAction($request->getRequestURI()->getPath()) | ->setAction($request->getRequestURI()->getPath()) | ||||
->appendChild( | ->appendControl( | ||||
id(new AphrontFormTokenizerControl()) | id(new AphrontFormTokenizerControl()) | ||||
->setLabel(pht('Projects')) | ->setLabel(pht('Projects')) | ||||
->setName('projects') | ->setName('projects') | ||||
->setValue($proj_t_values) | ->setValue($current_proj_phids) | ||||
->setID($tokenizer_id) | ->setID($tokenizer_id) | ||||
->setCaption( | ->setCaption( | ||||
javelin_tag( | javelin_tag( | ||||
'a', | 'a', | ||||
array( | array( | ||||
'href' => '/project/create/', | 'href' => '/project/create/', | ||||
'mustcapture' => true, | 'mustcapture' => true, | ||||
'sigil' => 'project-create', | 'sigil' => 'project-create', | ||||
▲ Show 20 Lines • Show All 73 Lines • Show Last 20 Lines |