mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-14 10:52:41 +01:00
ef85f49adc
Summary: This commit doesn't change license of any file. It just makes the license implicit (inherited from LICENSE file in the root directory). We are removing the headers for these reasons: - It wastes space in editors, less code is visible in editor upon opening a file. - It brings noise to diff of the first change of any file every year. - It confuses Git file copy detection when creating small files. - We don't have an explicit license header in other files (JS, CSS, images, documentation). - Using license header in every file is not obligatory: http://www.apache.org/dev/apply-license.html#new. This change is approved by Alma Chao (Lead Open Source and IP Counsel at Facebook). Test Plan: Verified that the license survived only in LICENSE file and that it didn't modify externals. Reviewers: epriestley, davidrecordon Reviewed By: epriestley CC: aran, Korvin Maniphest Tasks: T2035 Differential Revision: https://secure.phabricator.com/D3886
95 lines
3 KiB
PHP
95 lines
3 KiB
PHP
<?php
|
|
|
|
final class DiffusionCommitEditController extends DiffusionController {
|
|
|
|
public function willProcessRequest(array $data) {
|
|
$this->diffusionRequest = DiffusionRequest::newFromDictionary($data);
|
|
}
|
|
|
|
public function processRequest() {
|
|
|
|
$request = $this->getRequest();
|
|
$user = $request->getUser();
|
|
$drequest = $this->getDiffusionRequest();
|
|
$callsign = $drequest->getRepository()->getCallsign();
|
|
$repository = $drequest->getRepository();
|
|
$commit = $drequest->loadCommit();
|
|
$page_title = 'Edit Diffusion Commit';
|
|
|
|
if (!$commit) {
|
|
return new Aphront404Response();
|
|
}
|
|
|
|
$commit_phid = $commit->getPHID();
|
|
$edge_type = PhabricatorEdgeConfig::TYPE_COMMIT_HAS_PROJECT;
|
|
$current_proj_phids = PhabricatorEdgeQuery::loadDestinationPHIDs(
|
|
$commit_phid,
|
|
$edge_type
|
|
);
|
|
$handles = $this->loadViewerHandles($current_proj_phids);
|
|
$proj_t_values = mpull($handles, 'getFullName', 'getPHID');
|
|
|
|
if ($request->isFormPost()) {
|
|
$proj_phids = $request->getArr('projects');
|
|
$new_proj_phids = array_values($proj_phids);
|
|
$rem_proj_phids = array_diff($current_proj_phids,
|
|
$new_proj_phids);
|
|
$editor = id(new PhabricatorEdgeEditor());
|
|
$editor->setActor($user);
|
|
foreach ($rem_proj_phids as $phid) {
|
|
$editor->removeEdge($commit_phid, $edge_type, $phid);
|
|
}
|
|
foreach ($new_proj_phids as $phid) {
|
|
$editor->addEdge($commit_phid, $edge_type, $phid);
|
|
}
|
|
$editor->save();
|
|
|
|
PhabricatorSearchCommitIndexer::indexCommit($commit);
|
|
|
|
return id(new AphrontRedirectResponse())
|
|
->setURI('/r'.$callsign.$commit->getCommitIdentifier());
|
|
}
|
|
|
|
$tokenizer_id = celerity_generate_unique_node_id();
|
|
$form = id(new AphrontFormView())
|
|
->setUser($user)
|
|
->setAction($request->getRequestURI()->getPath())
|
|
->appendChild(
|
|
id(new AphrontFormTokenizerControl())
|
|
->setLabel('Projects')
|
|
->setName('projects')
|
|
->setValue($proj_t_values)
|
|
->setID($tokenizer_id)
|
|
->setCaption(
|
|
javelin_render_tag(
|
|
'a',
|
|
array(
|
|
'href' => '/project/create/',
|
|
'mustcapture' => true,
|
|
'sigil' => 'project-create',
|
|
),
|
|
'Create New Project'))
|
|
->setDatasource('/typeahead/common/projects/'));;
|
|
|
|
Javelin::initBehavior('project-create', array(
|
|
'tokenizerID' => $tokenizer_id,
|
|
));
|
|
|
|
$submit = id(new AphrontFormSubmitControl())
|
|
->setValue('Save')
|
|
->addCancelButton('/r'.$callsign.$commit->getCommitIdentifier());
|
|
$form->appendChild($submit);
|
|
|
|
$panel = id(new AphrontPanelView())
|
|
->setHeader('Edit Diffusion Commit')
|
|
->appendChild($form)
|
|
->setWidth(AphrontPanelView::WIDTH_FORM);
|
|
|
|
return $this->buildStandardPageResponse(
|
|
$panel,
|
|
array(
|
|
'title' => $page_title,
|
|
));
|
|
}
|
|
|
|
}
|