mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-30 01:10:58 +01:00
Update Herald for handleRequest
Summary: Update Herald for handleRequest Test Plan: New rule, test console, logs, lists. Reviewers: epriestley Reviewed By: epriestley Subscribers: epriestley, Korvin Maniphest Tasks: T8628 Differential Revision: https://secure.phabricator.com/D13765
This commit is contained in:
parent
42c0dd2b8e
commit
6d59f3d1f2
7 changed files with 31 additions and 67 deletions
|
@ -2,18 +2,10 @@
|
||||||
|
|
||||||
final class HeraldDisableController extends HeraldController {
|
final class HeraldDisableController extends HeraldController {
|
||||||
|
|
||||||
private $id;
|
public function handleRequest(AphrontRequest $request) {
|
||||||
private $action;
|
$viewer = $request->getViewer();
|
||||||
|
$id = $request->getURIData('id');
|
||||||
public function willProcessRequest(array $data) {
|
$action = $request->getURIData('action');
|
||||||
$this->id = $data['id'];
|
|
||||||
$this->action = $data['action'];
|
|
||||||
}
|
|
||||||
|
|
||||||
public function processRequest() {
|
|
||||||
$request = $this->getRequest();
|
|
||||||
$viewer = $request->getUser();
|
|
||||||
$id = $this->id;
|
|
||||||
|
|
||||||
$rule = id(new HeraldRuleQuery())
|
$rule = id(new HeraldRuleQuery())
|
||||||
->setViewer($viewer)
|
->setViewer($viewer)
|
||||||
|
@ -35,7 +27,7 @@ final class HeraldDisableController extends HeraldController {
|
||||||
|
|
||||||
$view_uri = $this->getApplicationURI("rule/{$id}/");
|
$view_uri = $this->getApplicationURI("rule/{$id}/");
|
||||||
|
|
||||||
$is_disable = ($this->action === 'disable');
|
$is_disable = ($action === 'disable');
|
||||||
|
|
||||||
if ($request->isFormPost()) {
|
if ($request->isFormPost()) {
|
||||||
$xaction = id(new HeraldRuleTransaction())
|
$xaction = id(new HeraldRuleTransaction())
|
||||||
|
|
|
@ -2,9 +2,8 @@
|
||||||
|
|
||||||
final class HeraldNewController extends HeraldController {
|
final class HeraldNewController extends HeraldController {
|
||||||
|
|
||||||
public function processRequest() {
|
public function handleRequest(AphrontRequest $request) {
|
||||||
$request = $this->getRequest();
|
$viewer = $request->getViewer();
|
||||||
$viewer = $request->getUser();
|
|
||||||
|
|
||||||
$content_type_map = HeraldAdapter::getEnabledAdapterMap($viewer);
|
$content_type_map = HeraldAdapter::getEnabledAdapterMap($viewer);
|
||||||
$rule_type_map = HeraldRuleTypeConfig::getRuleTypeMap();
|
$rule_type_map = HeraldRuleTypeConfig::getRuleTypeMap();
|
||||||
|
|
|
@ -2,24 +2,16 @@
|
||||||
|
|
||||||
final class HeraldRuleController extends HeraldController {
|
final class HeraldRuleController extends HeraldController {
|
||||||
|
|
||||||
private $id;
|
public function handleRequest(AphrontRequest $request) {
|
||||||
private $filter;
|
$viewer = $request->getViewer();
|
||||||
|
$id = $request->getURIData('id');
|
||||||
|
|
||||||
public function willProcessRequest(array $data) {
|
$content_type_map = HeraldAdapter::getEnabledAdapterMap($viewer);
|
||||||
$this->id = (int)idx($data, 'id');
|
|
||||||
}
|
|
||||||
|
|
||||||
public function processRequest() {
|
|
||||||
$request = $this->getRequest();
|
|
||||||
$user = $request->getUser();
|
|
||||||
|
|
||||||
$content_type_map = HeraldAdapter::getEnabledAdapterMap($user);
|
|
||||||
$rule_type_map = HeraldRuleTypeConfig::getRuleTypeMap();
|
$rule_type_map = HeraldRuleTypeConfig::getRuleTypeMap();
|
||||||
|
|
||||||
if ($this->id) {
|
if ($id) {
|
||||||
$id = $this->id;
|
|
||||||
$rule = id(new HeraldRuleQuery())
|
$rule = id(new HeraldRuleQuery())
|
||||||
->setViewer($user)
|
->setViewer($viewer)
|
||||||
->withIDs(array($id))
|
->withIDs(array($id))
|
||||||
->requireCapabilities(
|
->requireCapabilities(
|
||||||
array(
|
array(
|
||||||
|
@ -33,7 +25,7 @@ final class HeraldRuleController extends HeraldController {
|
||||||
$cancel_uri = $this->getApplicationURI("rule/{$id}/");
|
$cancel_uri = $this->getApplicationURI("rule/{$id}/");
|
||||||
} else {
|
} else {
|
||||||
$rule = new HeraldRule();
|
$rule = new HeraldRule();
|
||||||
$rule->setAuthorPHID($user->getPHID());
|
$rule->setAuthorPHID($viewer->getPHID());
|
||||||
$rule->setMustMatchAll(1);
|
$rule->setMustMatchAll(1);
|
||||||
|
|
||||||
$content_type = $request->getStr('content_type');
|
$content_type = $request->getStr('content_type');
|
||||||
|
@ -58,7 +50,7 @@ final class HeraldRuleController extends HeraldController {
|
||||||
if ($rule->isObjectRule()) {
|
if ($rule->isObjectRule()) {
|
||||||
$rule->setTriggerObjectPHID($request->getStr('targetPHID'));
|
$rule->setTriggerObjectPHID($request->getStr('targetPHID'));
|
||||||
$object = id(new PhabricatorObjectQuery())
|
$object = id(new PhabricatorObjectQuery())
|
||||||
->setViewer($user)
|
->setViewer($viewer)
|
||||||
->withPHIDs(array($rule->getTriggerObjectPHID()))
|
->withPHIDs(array($rule->getTriggerObjectPHID()))
|
||||||
->requireCapabilities(
|
->requireCapabilities(
|
||||||
array(
|
array(
|
||||||
|
@ -128,7 +120,7 @@ final class HeraldRuleController extends HeraldController {
|
||||||
$rule_type_name = $rule_type_map[$rule->getRuleType()];
|
$rule_type_name = $rule_type_map[$rule->getRuleType()];
|
||||||
|
|
||||||
$form = id(new AphrontFormView())
|
$form = id(new AphrontFormView())
|
||||||
->setUser($user)
|
->setUser($viewer)
|
||||||
->setID('herald-rule-edit-form')
|
->setID('herald-rule-edit-form')
|
||||||
->addHiddenInput('content_type', $rule->getContentType())
|
->addHiddenInput('content_type', $rule->getContentType())
|
||||||
->addHiddenInput('rule_type', $rule->getRuleType())
|
->addHiddenInput('rule_type', $rule->getRuleType())
|
||||||
|
|
|
@ -2,19 +2,15 @@
|
||||||
|
|
||||||
final class HeraldRuleListController extends HeraldController {
|
final class HeraldRuleListController extends HeraldController {
|
||||||
|
|
||||||
private $queryKey;
|
|
||||||
|
|
||||||
public function shouldAllowPublic() {
|
public function shouldAllowPublic() {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function willProcessRequest(array $data) {
|
public function handleRequest(AphrontRequest $request) {
|
||||||
$this->queryKey = idx($data, 'queryKey');
|
$querykey = $request->getURIData('queryKey');
|
||||||
}
|
|
||||||
|
|
||||||
public function processRequest() {
|
|
||||||
$controller = id(new PhabricatorApplicationSearchController())
|
$controller = id(new PhabricatorApplicationSearchController())
|
||||||
->setQueryKey($this->queryKey)
|
->setQueryKey($querykey)
|
||||||
->setSearchEngine(new HeraldRuleSearchEngine())
|
->setSearchEngine(new HeraldRuleSearchEngine())
|
||||||
->setNavigation($this->buildSideNavView());
|
->setNavigation($this->buildSideNavView());
|
||||||
|
|
||||||
|
|
|
@ -2,19 +2,13 @@
|
||||||
|
|
||||||
final class HeraldRuleViewController extends HeraldController {
|
final class HeraldRuleViewController extends HeraldController {
|
||||||
|
|
||||||
private $id;
|
public function handleRequest(AphrontRequest $request) {
|
||||||
|
$viewer = $request->getViewer();
|
||||||
public function willProcessRequest(array $data) {
|
$id = $request->getURIData('id');
|
||||||
$this->id = $data['id'];
|
|
||||||
}
|
|
||||||
|
|
||||||
public function processRequest() {
|
|
||||||
$request = $this->getRequest();
|
|
||||||
$viewer = $request->getUser();
|
|
||||||
|
|
||||||
$rule = id(new HeraldRuleQuery())
|
$rule = id(new HeraldRuleQuery())
|
||||||
->setViewer($viewer)
|
->setViewer($viewer)
|
||||||
->withIDs(array($this->id))
|
->withIDs(array($id))
|
||||||
->needConditionsAndActions(true)
|
->needConditionsAndActions(true)
|
||||||
->executeOne();
|
->executeOne();
|
||||||
if (!$rule) {
|
if (!$rule) {
|
||||||
|
|
|
@ -2,13 +2,8 @@
|
||||||
|
|
||||||
final class HeraldTestConsoleController extends HeraldController {
|
final class HeraldTestConsoleController extends HeraldController {
|
||||||
|
|
||||||
public function processRequest() {
|
public function handleRequest(AphrontRequest $request) {
|
||||||
|
$viewer = $request->getViewer();
|
||||||
$request = $this->getRequest();
|
|
||||||
$user = $request->getUser();
|
|
||||||
|
|
||||||
$request = $this->getRequest();
|
|
||||||
|
|
||||||
$object_name = trim($request->getStr('object_name'));
|
$object_name = trim($request->getStr('object_name'));
|
||||||
|
|
||||||
$e_name = true;
|
$e_name = true;
|
||||||
|
@ -21,7 +16,7 @@ final class HeraldTestConsoleController extends HeraldController {
|
||||||
|
|
||||||
if (!$errors) {
|
if (!$errors) {
|
||||||
$object = id(new PhabricatorObjectQuery())
|
$object = id(new PhabricatorObjectQuery())
|
||||||
->setViewer($user)
|
->setViewer($viewer)
|
||||||
->withNames(array($object_name))
|
->withNames(array($object_name))
|
||||||
->executeOne();
|
->executeOne();
|
||||||
|
|
||||||
|
@ -57,7 +52,7 @@ final class HeraldTestConsoleController extends HeraldController {
|
||||||
$adapter->setIsNewObject(false);
|
$adapter->setIsNewObject(false);
|
||||||
|
|
||||||
$rules = id(new HeraldRuleQuery())
|
$rules = id(new HeraldRuleQuery())
|
||||||
->setViewer($user)
|
->setViewer($viewer)
|
||||||
->withContentTypes(array($adapter->getAdapterContentType()))
|
->withContentTypes(array($adapter->getAdapterContentType()))
|
||||||
->withDisabled(false)
|
->withDisabled(false)
|
||||||
->needConditionsAndActions(true)
|
->needConditionsAndActions(true)
|
||||||
|
@ -80,7 +75,7 @@ final class HeraldTestConsoleController extends HeraldController {
|
||||||
}
|
}
|
||||||
|
|
||||||
$form = id(new AphrontFormView())
|
$form = id(new AphrontFormView())
|
||||||
->setUser($user)
|
->setUser($viewer)
|
||||||
->appendRemarkupInstructions(
|
->appendRemarkupInstructions(
|
||||||
pht(
|
pht(
|
||||||
'Enter an object to test rules for, like a Diffusion commit (e.g., '.
|
'Enter an object to test rules for, like a Diffusion commit (e.g., '.
|
||||||
|
|
|
@ -2,8 +2,6 @@
|
||||||
|
|
||||||
final class HeraldTranscriptListController extends HeraldController {
|
final class HeraldTranscriptListController extends HeraldController {
|
||||||
|
|
||||||
private $queryKey;
|
|
||||||
|
|
||||||
public function buildSideNavView($for_app = false) {
|
public function buildSideNavView($for_app = false) {
|
||||||
$user = $this->getRequest()->getUser();
|
$user = $this->getRequest()->getUser();
|
||||||
|
|
||||||
|
@ -32,13 +30,11 @@ final class HeraldTranscriptListController extends HeraldController {
|
||||||
return $crumbs;
|
return $crumbs;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function willProcessRequest(array $data) {
|
public function handleRequest(AphrontRequest $request) {
|
||||||
$this->queryKey = idx($data, 'queryKey');
|
$querykey = $request->getURIData('queryKey');
|
||||||
}
|
|
||||||
|
|
||||||
public function processRequest() {
|
|
||||||
$controller = id(new PhabricatorApplicationSearchController())
|
$controller = id(new PhabricatorApplicationSearchController())
|
||||||
->setQueryKey($this->queryKey)
|
->setQueryKey($querykey)
|
||||||
->setSearchEngine(new HeraldTranscriptSearchEngine())
|
->setSearchEngine(new HeraldTranscriptSearchEngine())
|
||||||
->setNavigation($this->buildSideNavView());
|
->setNavigation($this->buildSideNavView());
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue