forked from phacility/phabricator
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPhabricatorProjectSubprojectWarningController.php
51 lines (39 loc) · 1.36 KB
/
PhabricatorProjectSubprojectWarningController.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
<?php
final class PhabricatorProjectSubprojectWarningController
extends PhabricatorProjectController {
public function handleRequest(AphrontRequest $request) {
$viewer = $request->getViewer();
$response = $this->loadProject();
if ($response) {
return $response;
}
$project = $this->getProject();
$can_edit = PhabricatorPolicyFilter::hasCapability(
$viewer,
$project,
PhabricatorPolicyCapability::CAN_EDIT);
if (!$can_edit) {
return new Aphront404Response();
}
$id = $project->getID();
$cancel_uri = "/project/subprojects/{$id}/";
$done_uri = "/project/edit/?parent={$id}";
if ($request->isFormPost()) {
return id(new AphrontRedirectResponse())
->setURI($done_uri);
}
$doc_href = PhabricatorEnv::getDoclink('Projects User Guide');
$conversion_help = pht(
"Creating a project's first subproject **moves all ".
"members** to become members of the subproject instead.".
"\n\n".
"See [[ %s | Projects User Guide ]] in the documentation for details. ".
"This process can not be undone.",
$doc_href);
return $this->newDialog()
->setTitle(pht('Convert to Parent Project'))
->appendChild(new PHUIRemarkupView($viewer, $conversion_help))
->addCancelButton($cancel_uri)
->addSubmitButton(pht('Convert Project'));
}
}