forked from phacility/phabricator
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathReleephBranchNamePreviewController.php
48 lines (37 loc) · 1.13 KB
/
ReleephBranchNamePreviewController.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
<?php
final class ReleephBranchNamePreviewController
extends ReleephController {
public function processRequest() {
$request = $this->getRequest();
$is_symbolic = $request->getBool('isSymbolic');
$template = $request->getStr('template');
if (!$is_symbolic && !$template) {
$template = ReleephBranchTemplate::getDefaultTemplate();
}
$arc_project_id = $request->getInt('arcProjectID');
$fake_commit_handle =
ReleephBranchTemplate::getFakeCommitHandleFor(
$arc_project_id,
$request->getUser());
list($name, $errors) = id(new ReleephBranchTemplate())
->setCommitHandle($fake_commit_handle)
->setReleephProjectName($request->getStr('projectName'))
->setSymbolic($is_symbolic)
->interpolate($template);
$markup = '';
if ($name) {
$markup = phutil_tag(
'div',
array('class' => 'name'),
$name);
}
if ($errors) {
$markup .= phutil_tag(
'div',
array('class' => 'error'),
head($errors));
}
return id(new AphrontAjaxResponse())
->setContent(array('markup' => $markup));
}
}