mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-11 17:32:41 +01:00
904a24c1df
Summary: Fixes T3548. Concrete Releeph controllers currently extend either from ReleephController or PhabricatorController directly. Instead, make them all extend ReleephController. Introduce ReleephProjectController for controllers which depend on project context. Project context code which lived in ReleephController moves to ReleephProjectController. Test Plan: Viewed list, project, releases, requests. Reviewers: btrahan, edward Reviewed By: edward CC: aran Maniphest Tasks: T3548 Differential Revision: https://secure.phabricator.com/D6472
46 lines
1.1 KiB
PHP
46 lines
1.1 KiB
PHP
<?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);
|
|
|
|
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));
|
|
}
|
|
|
|
}
|