Enable Phabricator admin to change the owner of a herald rule
Summary: Added a typeahead in the edit herald rule page that allows an admin or owner to change the current owner of a rule. If the typeahead is emptied, the current owner will remain owner. Test Plan: Created a test rule. Changed the owner. Deleted the owner in the typahead. Verified expected behavior. Reviewers: jungejason, epriestley Reviewed By: epriestley CC: aran, jungejason, epriestley, xela Differential Revision: https://secure.phabricator.com/D1322
This commit is contained in:
@@ -285,7 +285,7 @@ celerity_register_resource_map(array(
|
||||
),
|
||||
'herald-css' =>
|
||||
array(
|
||||
'uri' => '/res/5051f3ab/rsrc/css/application/herald/herald.css',
|
||||
'uri' => '/res/ed5556e6/rsrc/css/application/herald/herald.css',
|
||||
'type' => 'css',
|
||||
'requires' =>
|
||||
array(
|
||||
@@ -294,7 +294,7 @@ celerity_register_resource_map(array(
|
||||
),
|
||||
'herald-rule-editor' =>
|
||||
array(
|
||||
'uri' => '/res/4d6dff2b/rsrc/js/application/herald/HeraldRuleEditor.js',
|
||||
'uri' => '/res/ec9eea63/rsrc/js/application/herald/HeraldRuleEditor.js',
|
||||
'type' => 'js',
|
||||
'requires' =>
|
||||
array(
|
||||
@@ -332,14 +332,13 @@ celerity_register_resource_map(array(
|
||||
),
|
||||
0 =>
|
||||
array(
|
||||
'uri' => '/res/b6096fdd/rsrc/js/javelin/lib/__tests__/URI.js',
|
||||
'uri' => '/res/14c48a9f/rsrc/js/javelin/lib/__tests__/behavior.js',
|
||||
'type' => 'js',
|
||||
'requires' =>
|
||||
array(
|
||||
0 => 'javelin-uri',
|
||||
1 => 'javelin-php-serializer',
|
||||
0 => 'javelin-behavior',
|
||||
),
|
||||
'disk' => '/rsrc/js/javelin/lib/__tests__/URI.js',
|
||||
'disk' => '/rsrc/js/javelin/lib/__tests__/behavior.js',
|
||||
),
|
||||
'javelin-behavior-aphront-basic-tokenizer' =>
|
||||
array(
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* Copyright 2011 Facebook, Inc.
|
||||
* Copyright 2012 Facebook, Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -127,9 +127,18 @@ class HeraldRuleController extends HeraldController {
|
||||
->setError($e_name)
|
||||
->setValue($rule->getName()))
|
||||
->appendChild(
|
||||
id(new AphrontFormStaticControl())
|
||||
->setLabel('Author')
|
||||
->setValue($handles[$rule->getAuthorPHID()]->getName()))
|
||||
id(new AphrontFormMarkupControl())
|
||||
->setLabel('Owner')
|
||||
->setValue('<div id="author-input"/>'))
|
||||
->appendChild(
|
||||
// Build this explicitly so we can add a sigil to it.
|
||||
javelin_render_tag(
|
||||
'input',
|
||||
array(
|
||||
'type' => 'hidden',
|
||||
'name' => 'author',
|
||||
'sigil' => 'author',
|
||||
)))
|
||||
->appendChild(
|
||||
id(new AphrontFormMarkupControl())
|
||||
->setValue(
|
||||
@@ -317,6 +326,11 @@ class HeraldRuleController extends HeraldController {
|
||||
$actions[] = $obj;
|
||||
}
|
||||
|
||||
$author = $request->getStr('author');
|
||||
if ($author) {
|
||||
$rule->setAuthorPHID($author);
|
||||
}
|
||||
|
||||
$rule->attachConditions($conditions);
|
||||
$rule->attachActions($actions);
|
||||
|
||||
@@ -427,6 +441,8 @@ class HeraldRuleController extends HeraldController {
|
||||
'template' => $this->buildTokenizerTemplates() + array(
|
||||
'rules' => $all_rules,
|
||||
),
|
||||
'author' => array($rule->getAuthorPHID() =>
|
||||
$handles[$rule->getAuthorPHID()]->getName()),
|
||||
'info' => $config_info,
|
||||
));
|
||||
}
|
||||
@@ -456,6 +472,7 @@ class HeraldRuleController extends HeraldController {
|
||||
}
|
||||
}
|
||||
|
||||
$phids += array($rule->getAuthorPHID());
|
||||
$handles = id(new PhabricatorObjectHandleData($phids))
|
||||
->loadHandles();
|
||||
return $handles;
|
||||
|
||||
@@ -25,7 +25,6 @@ phutil_require_module('phabricator', 'infrastructure/javelin/markup');
|
||||
phutil_require_module('phabricator', 'view/control/tokenizer');
|
||||
phutil_require_module('phabricator', 'view/form/base');
|
||||
phutil_require_module('phabricator', 'view/form/control/markup');
|
||||
phutil_require_module('phabricator', 'view/form/control/static');
|
||||
phutil_require_module('phabricator', 'view/form/control/submit');
|
||||
phutil_require_module('phabricator', 'view/form/control/text');
|
||||
phutil_require_module('phabricator', 'view/form/error');
|
||||
|
||||
Reference in New Issue
Block a user