mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-10 08:52:39 +01:00
Add a "mailable" function datasource
Summary: Ref T4100. Add a function datasource for filtering mailable objects (e.g., subscribers). Test Plan: Searched for objects with "Current Viewer", "Members: Dog Project", etc., as a subscriber in global search. Reviewers: btrahan Reviewed By: btrahan Subscribers: epriestley Maniphest Tasks: T4100 Differential Revision: https://secure.phabricator.com/D12524
This commit is contained in:
parent
135c8799e6
commit
3e9ebb8e20
3 changed files with 40 additions and 2 deletions
|
@ -2038,6 +2038,7 @@ phutil_register_library_map(array(
|
|||
'PhabricatorMetaMTAMailSection' => 'applications/metamta/view/PhabricatorMetaMTAMailSection.php',
|
||||
'PhabricatorMetaMTAMailTestCase' => 'applications/metamta/storage/__tests__/PhabricatorMetaMTAMailTestCase.php',
|
||||
'PhabricatorMetaMTAMailableDatasource' => 'applications/metamta/typeahead/PhabricatorMetaMTAMailableDatasource.php',
|
||||
'PhabricatorMetaMTAMailableFunctionDatasource' => 'applications/metamta/typeahead/PhabricatorMetaMTAMailableFunctionDatasource.php',
|
||||
'PhabricatorMetaMTAMailgunReceiveController' => 'applications/metamta/controller/PhabricatorMetaMTAMailgunReceiveController.php',
|
||||
'PhabricatorMetaMTAMailingList' => 'applications/mailinglists/storage/PhabricatorMetaMTAMailingList.php',
|
||||
'PhabricatorMetaMTAMemberQuery' => 'applications/metamta/query/PhabricatorMetaMTAMemberQuery.php',
|
||||
|
@ -5392,6 +5393,7 @@ phutil_register_library_map(array(
|
|||
'PhabricatorMetaMTAMailBodyTestCase' => 'PhabricatorTestCase',
|
||||
'PhabricatorMetaMTAMailTestCase' => 'PhabricatorTestCase',
|
||||
'PhabricatorMetaMTAMailableDatasource' => 'PhabricatorTypeaheadCompositeDatasource',
|
||||
'PhabricatorMetaMTAMailableFunctionDatasource' => 'PhabricatorTypeaheadCompositeDatasource',
|
||||
'PhabricatorMetaMTAMailgunReceiveController' => 'PhabricatorMetaMTAController',
|
||||
'PhabricatorMetaMTAMailingList' => array(
|
||||
'PhabricatorMetaMTADAO',
|
||||
|
|
|
@ -0,0 +1,28 @@
|
|||
<?php
|
||||
|
||||
final class PhabricatorMetaMTAMailableFunctionDatasource
|
||||
extends PhabricatorTypeaheadCompositeDatasource {
|
||||
|
||||
public function getBrowseTitle() {
|
||||
return pht('Browse Subscribers');
|
||||
}
|
||||
|
||||
public function getPlaceholderText() {
|
||||
return pht('Type a username, project, mailing list, or function...');
|
||||
}
|
||||
|
||||
public function getDatasourceApplicationClass() {
|
||||
return 'PhabricatorMetaMTAApplication';
|
||||
}
|
||||
|
||||
public function getComponentDatasources() {
|
||||
return array(
|
||||
new PhabricatorViewerDatasource(),
|
||||
new PhabricatorPeopleDatasource(),
|
||||
new PhabricatorProjectMembersDatasource(),
|
||||
new PhabricatorProjectDatasource(),
|
||||
new PhabricatorMailingListDatasource(),
|
||||
);
|
||||
}
|
||||
|
||||
}
|
|
@ -32,7 +32,7 @@ final class PhabricatorSearchApplicationSearchEngine
|
|||
|
||||
$saved->setParameter(
|
||||
'subscriberPHIDs',
|
||||
$this->readPHIDsFromRequest($request, 'subscriberPHIDs'));
|
||||
$this->readSubscribersFromRequest($request, 'subscriberPHIDs'));
|
||||
|
||||
$saved->setParameter(
|
||||
'projectPHIDs',
|
||||
|
@ -68,6 +68,14 @@ final class PhabricatorSearchApplicationSearchEngine
|
|||
$author_phids = $datasource->evaluateTokens($author_phids);
|
||||
$config->setParameter('authorPHIDs', $author_phids);
|
||||
|
||||
|
||||
$datasource = id(new PhabricatorMetaMTAMailableFunctionDatasource())
|
||||
->setViewer($viewer);
|
||||
$subscriber_phids = $config->getParameter('subscriberPHIDs', array());
|
||||
$subscriber_phids = $datasource->evaluateTokens($subscriber_phids);
|
||||
$config->setParameter('subscriberPHIDs', $subscriber_phids);
|
||||
|
||||
|
||||
$query->withSavedQuery($config);
|
||||
|
||||
return $query;
|
||||
|
@ -146,7 +154,7 @@ final class PhabricatorSearchApplicationSearchEngine
|
|||
id(new AphrontFormTokenizerControl())
|
||||
->setName('subscriberPHIDs')
|
||||
->setLabel('Subscribers')
|
||||
->setDatasource(new PhabricatorMetaMTAMailableDatasource())
|
||||
->setDatasource(new PhabricatorMetaMTAMailableFunctionDatasource())
|
||||
->setValue($subscriber_phids))
|
||||
->appendControl(
|
||||
id(new AphrontFormTokenizerControl())
|
||||
|
|
Loading…
Reference in a new issue