Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F14060952
D9875.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
5 KB
Referenced Files
None
Subscribers
None
D9875.diff
View Options
diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php
--- a/src/__phutil_library_map__.php
+++ b/src/__phutil_library_map__.php
@@ -1719,6 +1719,7 @@
'PhabricatorMacroCommentController' => 'applications/macro/controller/PhabricatorMacroCommentController.php',
'PhabricatorMacroConfigOptions' => 'applications/macro/config/PhabricatorMacroConfigOptions.php',
'PhabricatorMacroController' => 'applications/macro/controller/PhabricatorMacroController.php',
+ 'PhabricatorMacroDatasource' => 'applications/macro/typeahead/PhabricatorMacroDatasource.php',
'PhabricatorMacroDisableController' => 'applications/macro/controller/PhabricatorMacroDisableController.php',
'PhabricatorMacroEditController' => 'applications/macro/controller/PhabricatorMacroEditController.php',
'PhabricatorMacroEditor' => 'applications/macro/editor/PhabricatorMacroEditor.php',
@@ -4565,6 +4566,7 @@
'PhabricatorMacroCommentController' => 'PhabricatorMacroController',
'PhabricatorMacroConfigOptions' => 'PhabricatorApplicationConfigOptions',
'PhabricatorMacroController' => 'PhabricatorController',
+ 'PhabricatorMacroDatasource' => 'PhabricatorTypeaheadDatasource',
'PhabricatorMacroDisableController' => 'PhabricatorMacroController',
'PhabricatorMacroEditController' => 'PhabricatorMacroController',
'PhabricatorMacroEditor' => 'PhabricatorApplicationTransactionEditor',
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
@@ -50,7 +50,7 @@
->setLabel(pht('Macro'))
->setName('macro')
->setLimit(1)
- ->setDatasource('/typeahead/common/macros/')
+ ->setDatasource(new PhabricatorMacroDatasource())
->setError($e_macro))
->appendChild(
id(new AphrontFormTextControl())
diff --git a/src/applications/macro/phid/PhabricatorMacroPHIDTypeMacro.php b/src/applications/macro/phid/PhabricatorMacroPHIDTypeMacro.php
--- a/src/applications/macro/phid/PhabricatorMacroPHIDTypeMacro.php
+++ b/src/applications/macro/phid/PhabricatorMacroPHIDTypeMacro.php
@@ -12,6 +12,10 @@
return pht('Image Macro');
}
+ public function getTypeIcon() {
+ return 'fa-meh-o';
+ }
+
public function newObject() {
return new PhabricatorFileImageMacro();
}
diff --git a/src/applications/macro/typeahead/PhabricatorMacroDatasource.php b/src/applications/macro/typeahead/PhabricatorMacroDatasource.php
new file mode 100644
--- /dev/null
+++ b/src/applications/macro/typeahead/PhabricatorMacroDatasource.php
@@ -0,0 +1,35 @@
+<?php
+
+final class PhabricatorMacroDatasource
+ extends PhabricatorTypeaheadDatasource {
+
+ public function getPlaceholderText() {
+ return pht('Type a macro name...');
+ }
+
+ public function getDatasourceApplicationClass() {
+ return 'PhabricatorApplicationMacro';
+ }
+
+ public function loadResults() {
+ $viewer = $this->getViewer();
+ $raw_query = $this->getRawQuery();
+
+ $results = array();
+
+ $macros = id(new PhabricatorMacroQuery())
+ ->setViewer($viewer)
+ ->withStatus(PhabricatorMacroQuery::STATUS_ACTIVE)
+ ->execute();
+
+ foreach ($macros as $macro) {
+ $results[] = id(new PhabricatorTypeaheadResult())
+ ->setPHID($macro->getPHID())
+ ->setName($macro->getName())
+ ->setIcon('fa-meh-o bluegrey');
+ }
+
+ return $results;
+ }
+
+}
diff --git a/src/applications/repository/phid/PhabricatorRepositoryPHIDTypeRepository.php b/src/applications/repository/phid/PhabricatorRepositoryPHIDTypeRepository.php
--- a/src/applications/repository/phid/PhabricatorRepositoryPHIDTypeRepository.php
+++ b/src/applications/repository/phid/PhabricatorRepositoryPHIDTypeRepository.php
@@ -13,6 +13,10 @@
return pht('Repository');
}
+ public function getTypeIcon() {
+ return 'fa-database';
+ }
+
public function newObject() {
return new PhabricatorRepository();
}
@@ -40,7 +44,6 @@
$handle->setName($monogram);
$handle->setFullName("{$monogram} {$name}");
$handle->setURI("/diffusion/{$callsign}/");
- $handle->setIcon('fa-database');
}
}
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
@@ -34,7 +34,6 @@
$need_jump_objects = false;
$need_build_plans = false;
$need_task_priority = false;
- $need_macros = false;
$need_legalpad_documents = false;
switch ($this->type) {
case 'mainsearch':
@@ -89,9 +88,6 @@
case 'taskpriority':
$need_task_priority = true;
break;
- case 'macros':
- $need_macros = true;
- break;
case 'legalpaddocuments':
$need_legalpad_documents = true;
break;
@@ -243,19 +239,6 @@
}
}
- 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_legalpad_documents) {
$documents = id(new LegalpadDocumentQuery())
->setViewer($viewer)
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Tue, Nov 19, 4:26 AM (15 h, 57 m ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6746995
Default Alt Text
D9875.diff (5 KB)
Attached To
Mode
D9875: Modernize "macro" typeahead datasource
Attached
Detach File
Event Timeline
Log In to Comment