Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F86006
D7658.diff
All Users
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
3 KB
Referenced Files
None
Subscribers
None
D7658.diff
View Options
diff --git a/src/applications/macro/controller/PhabricatorMacroMemeDialogController.php b/src/applications/macro/controller/PhabricatorMacroMemeDialogController.php
--- a/src/applications/macro/controller/PhabricatorMacroMemeDialogController.php
+++ b/src/applications/macro/controller/PhabricatorMacroMemeDialogController.php
@@ -7,20 +7,20 @@
$request = $this->getRequest();
$user = $request->getUser();
- $name = $request->getStr('macro');
+ $phid = head($request->getArr('macro'));
$above = $request->getStr('above');
$below = $request->getStr('below');
$e_macro = true;
$errors = array();
if ($request->isDialogFormPost()) {
- if (!$name) {
+ if (!$phid) {
$e_macro = pht('Required');
$errors[] = pht('Macro name is required.');
} else {
$macro = id(new PhabricatorMacroQuery())
->setViewer($user)
- ->withNames(array($name))
+ ->withPHIDs(array($phid))
->executeOne();
if (!$macro) {
$e_macro = pht('Invalid');
@@ -31,7 +31,7 @@
if (!$errors) {
$options = new PhutilSimpleOptions();
$data = array(
- 'src' => $name,
+ 'src' => $macro->getName(),
'above' => $above,
'below' => $below,
);
@@ -46,10 +46,11 @@
$view = id(new PHUIFormLayoutView())
->appendChild(
- id(new AphrontFormTextControl())
+ id(new AphrontFormTokenizerControl())
->setLabel(pht('Macro'))
->setName('macro')
- ->setValue($name)
+ ->setLimit(1)
+ ->setDatasource('/typeahead/common/macros/')
->setError($e_macro))
->appendChild(
id(new AphrontFormTextControl())
diff --git a/src/applications/typeahead/controller/PhabricatorTypeaheadCommonDatasourceController.php b/src/applications/typeahead/controller/PhabricatorTypeaheadCommonDatasourceController.php
--- a/src/applications/typeahead/controller/PhabricatorTypeaheadCommonDatasourceController.php
+++ b/src/applications/typeahead/controller/PhabricatorTypeaheadCommonDatasourceController.php
@@ -36,6 +36,7 @@
$need_symbols = false;
$need_jump_objects = false;
$need_build_plans = false;
+ $need_macros = false;
switch ($this->type) {
case 'mainsearch':
$need_users = true;
@@ -97,6 +98,9 @@
case 'buildplans':
$need_build_plans = true;
break;
+ case 'macros':
+ $need_macros = true;
+ break;
}
$results = array();
@@ -113,6 +117,7 @@
->setPHID(ManiphestTaskOwner::PROJECT_NO_PROJECT);
}
+
if ($need_users) {
$columns = array(
'isSystemAgent',
@@ -234,6 +239,19 @@
}
}
+ if ($need_macros) {
+ $macros = id(new PhabricatorMacroQuery())
+ ->setViewer($viewer)
+ ->withStatus(PhabricatorMacroQuery::STATUS_ACTIVE)
+ ->execute();
+ $macros = mpull($macros, 'getName', 'getPHID');
+ foreach ($macros as $phid => $name) {
+ $results[] = id(new PhabricatorTypeaheadResult())
+ ->setPHID($phid)
+ ->setName($name);
+ }
+ }
+
if ($need_projs) {
$projs = id(new PhabricatorProjectQuery())
->setViewer($viewer)
diff --git a/src/view/form/control/AphrontFormTokenizerControl.php b/src/view/form/control/AphrontFormTokenizerControl.php
--- a/src/view/form/control/AphrontFormTokenizerControl.php
+++ b/src/view/form/control/AphrontFormTokenizerControl.php
@@ -97,6 +97,7 @@
'packages' => pht('Type a package name...'),
'arcanistproject' => pht('Type an arc project name...'),
'accountsorprojects' => pht('Type a user or project name...'),
+ 'macros' => pht('Type a macro name...'),
);
return idx($map, $request);
File Metadata
Details
Attached
Mime Type
text/x-diff
Storage Engine
amazon-s3
Storage Format
Raw Data
Storage Handle
phabricator/za/7b/lcdmqysxqykypiuy
Default Alt Text
D7658.diff (3 KB)
Attached To
Mode
D7658: Turn the macro selector into a tokenizer
Attached
Detach File
Event Timeline
Log In to Comment