mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-20 04:20:55 +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 {
|
||||
|
||||
private $id;
|
||||
private $action;
|
||||
|
||||
public function willProcessRequest(array $data) {
|
||||
$this->id = $data['id'];
|
||||
$this->action = $data['action'];
|
||||
}
|
||||
|
||||
public function processRequest() {
|
||||
$request = $this->getRequest();
|
||||
$viewer = $request->getUser();
|
||||
$id = $this->id;
|
||||
public function handleRequest(AphrontRequest $request) {
|
||||
$viewer = $request->getViewer();
|
||||
$id = $request->getURIData('id');
|
||||
$action = $request->getURIData('action');
|
||||
|
||||
$rule = id(new HeraldRuleQuery())
|
||||
->setViewer($viewer)
|
||||
|
@ -35,7 +27,7 @@ final class HeraldDisableController extends HeraldController {
|
|||
|
||||
$view_uri = $this->getApplicationURI("rule/{$id}/");
|
||||
|
||||
$is_disable = ($this->action === 'disable');
|
||||
$is_disable = ($action === 'disable');
|
||||
|
||||
if ($request->isFormPost()) {
|
||||
$xaction = id(new HeraldRuleTransaction())
|
||||
|
|
|
@ -2,9 +2,8 @@
|
|||
|
||||
final class HeraldNewController extends HeraldController {
|
||||
|
||||
public function processRequest() {
|
||||
$request = $this->getRequest();
|
||||
$viewer = $request->getUser();
|
||||
public function handleRequest(AphrontRequest $request) {
|
||||
$viewer = $request->getViewer();
|
||||
|
||||
$content_type_map = HeraldAdapter::getEnabledAdapterMap($viewer);
|
||||
$rule_type_map = HeraldRuleTypeConfig::getRuleTypeMap();
|
||||
|
|
|
@ -2,24 +2,16 @@
|
|||
|
||||
final class HeraldRuleController extends HeraldController {
|
||||
|
||||
private $id;
|
||||
private $filter;
|
||||
public function handleRequest(AphrontRequest $request) {
|
||||
$viewer = $request->getViewer();
|
||||
$id = $request->getURIData('id');
|
||||
|
||||
public function willProcessRequest(array $data) {
|
||||
$this->id = (int)idx($data, 'id');
|
||||
}
|
||||
|
||||
public function processRequest() {
|
||||
$request = $this->getRequest();
|
||||
$user = $request->getUser();
|
||||
|
||||
$content_type_map = HeraldAdapter::getEnabledAdapterMap($user);
|
||||
$content_type_map = HeraldAdapter::getEnabledAdapterMap($viewer);
|
||||
$rule_type_map = HeraldRuleTypeConfig::getRuleTypeMap();
|
||||
|
||||
if ($this->id) {
|
||||
$id = $this->id;
|
||||
if ($id) {
|
||||
$rule = id(new HeraldRuleQuery())
|
||||
->setViewer($user)
|
||||
->setViewer($viewer)
|
||||
->withIDs(array($id))
|
||||
->requireCapabilities(
|
||||
array(
|
||||
|
@ -33,7 +25,7 @@ final class HeraldRuleController extends HeraldController {
|
|||
$cancel_uri = $this->getApplicationURI("rule/{$id}/");
|
||||
} else {
|
||||
$rule = new HeraldRule();
|
||||
$rule->setAuthorPHID($user->getPHID());
|
||||
$rule->setAuthorPHID($viewer->getPHID());
|
||||
$rule->setMustMatchAll(1);
|
||||
|
||||
$content_type = $request->getStr('content_type');
|
||||
|
@ -58,7 +50,7 @@ final class HeraldRuleController extends HeraldController {
|
|||
if ($rule->isObjectRule()) {
|
||||
$rule->setTriggerObjectPHID($request->getStr('targetPHID'));
|
||||
$object = id(new PhabricatorObjectQuery())
|
||||
->setViewer($user)
|
||||
->setViewer($viewer)
|
||||
->withPHIDs(array($rule->getTriggerObjectPHID()))
|
||||
->requireCapabilities(
|
||||
array(
|
||||
|
@ -128,7 +120,7 @@ final class HeraldRuleController extends HeraldController {
|
|||
$rule_type_name = $rule_type_map[$rule->getRuleType()];
|
||||
|
||||
$form = id(new AphrontFormView())
|
||||
->setUser($user)
|
||||
->setUser($viewer)
|
||||
->setID('herald-rule-edit-form')
|
||||
->addHiddenInput('content_type', $rule->getContentType())
|
||||
->addHiddenInput('rule_type', $rule->getRuleType())
|
||||
|
|
|
@ -2,19 +2,15 @@
|
|||
|
||||
final class HeraldRuleListController extends HeraldController {
|
||||
|
||||
private $queryKey;
|
||||
|
||||
public function shouldAllowPublic() {
|
||||
return true;
|
||||
}
|
||||
|
||||
public function willProcessRequest(array $data) {
|
||||
$this->queryKey = idx($data, 'queryKey');
|
||||
}
|
||||
public function handleRequest(AphrontRequest $request) {
|
||||
$querykey = $request->getURIData('queryKey');
|
||||
|
||||
public function processRequest() {
|
||||
$controller = id(new PhabricatorApplicationSearchController())
|
||||
->setQueryKey($this->queryKey)
|
||||
->setQueryKey($querykey)
|
||||
->setSearchEngine(new HeraldRuleSearchEngine())
|
||||
->setNavigation($this->buildSideNavView());
|
||||
|
||||
|
|
|
@ -2,19 +2,13 @@
|
|||
|
||||
final class HeraldRuleViewController extends HeraldController {
|
||||
|
||||
private $id;
|
||||
|
||||
public function willProcessRequest(array $data) {
|
||||
$this->id = $data['id'];
|
||||
}
|
||||
|
||||
public function processRequest() {
|
||||
$request = $this->getRequest();
|
||||
$viewer = $request->getUser();
|
||||
public function handleRequest(AphrontRequest $request) {
|
||||
$viewer = $request->getViewer();
|
||||
$id = $request->getURIData('id');
|
||||
|
||||
$rule = id(new HeraldRuleQuery())
|
||||
->setViewer($viewer)
|
||||
->withIDs(array($this->id))
|
||||
->withIDs(array($id))
|
||||
->needConditionsAndActions(true)
|
||||
->executeOne();
|
||||
if (!$rule) {
|
||||
|
|
|
@ -2,13 +2,8 @@
|
|||
|
||||
final class HeraldTestConsoleController extends HeraldController {
|
||||
|
||||
public function processRequest() {
|
||||
|
||||
$request = $this->getRequest();
|
||||
$user = $request->getUser();
|
||||
|
||||
$request = $this->getRequest();
|
||||
|
||||
public function handleRequest(AphrontRequest $request) {
|
||||
$viewer = $request->getViewer();
|
||||
$object_name = trim($request->getStr('object_name'));
|
||||
|
||||
$e_name = true;
|
||||
|
@ -21,7 +16,7 @@ final class HeraldTestConsoleController extends HeraldController {
|
|||
|
||||
if (!$errors) {
|
||||
$object = id(new PhabricatorObjectQuery())
|
||||
->setViewer($user)
|
||||
->setViewer($viewer)
|
||||
->withNames(array($object_name))
|
||||
->executeOne();
|
||||
|
||||
|
@ -57,7 +52,7 @@ final class HeraldTestConsoleController extends HeraldController {
|
|||
$adapter->setIsNewObject(false);
|
||||
|
||||
$rules = id(new HeraldRuleQuery())
|
||||
->setViewer($user)
|
||||
->setViewer($viewer)
|
||||
->withContentTypes(array($adapter->getAdapterContentType()))
|
||||
->withDisabled(false)
|
||||
->needConditionsAndActions(true)
|
||||
|
@ -80,7 +75,7 @@ final class HeraldTestConsoleController extends HeraldController {
|
|||
}
|
||||
|
||||
$form = id(new AphrontFormView())
|
||||
->setUser($user)
|
||||
->setUser($viewer)
|
||||
->appendRemarkupInstructions(
|
||||
pht(
|
||||
'Enter an object to test rules for, like a Diffusion commit (e.g., '.
|
||||
|
|
|
@ -2,8 +2,6 @@
|
|||
|
||||
final class HeraldTranscriptListController extends HeraldController {
|
||||
|
||||
private $queryKey;
|
||||
|
||||
public function buildSideNavView($for_app = false) {
|
||||
$user = $this->getRequest()->getUser();
|
||||
|
||||
|
@ -32,13 +30,11 @@ final class HeraldTranscriptListController extends HeraldController {
|
|||
return $crumbs;
|
||||
}
|
||||
|
||||
public function willProcessRequest(array $data) {
|
||||
$this->queryKey = idx($data, 'queryKey');
|
||||
}
|
||||
public function handleRequest(AphrontRequest $request) {
|
||||
$querykey = $request->getURIData('queryKey');
|
||||
|
||||
public function processRequest() {
|
||||
$controller = id(new PhabricatorApplicationSearchController())
|
||||
->setQueryKey($this->queryKey)
|
||||
->setQueryKey($querykey)
|
||||
->setSearchEngine(new HeraldTranscriptSearchEngine())
|
||||
->setNavigation($this->buildSideNavView());
|
||||
|
||||
|
|
Loading…
Reference in a new issue