mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-19 03:50:54 +01:00
Use parameterized datasources for Maniphest authors and subscribers
Summary: Ref T4100. Update these controls to allow functions like `viewer()`. Test Plan: Used the new controls. Reviewers: btrahan Reviewed By: btrahan Subscribers: epriestley Maniphest Tasks: T4100 Differential Revision: https://secure.phabricator.com/D12527
This commit is contained in:
parent
22e3e35418
commit
fcaf56332f
2 changed files with 15 additions and 5 deletions
|
@ -55,7 +55,7 @@ final class ManiphestTaskSearchEngine
|
|||
|
||||
$saved->setParameter(
|
||||
'subscriberPHIDs',
|
||||
$this->readPHIDsFromRequest($request, 'subscribers'));
|
||||
$this->readSubscribersFromRequest($request, 'subscribers'));
|
||||
|
||||
$saved->setParameter(
|
||||
'statuses',
|
||||
|
@ -111,12 +111,21 @@ final class ManiphestTaskSearchEngine
|
|||
$query = id(new ManiphestTaskQuery())
|
||||
->needProjectPHIDs(true);
|
||||
|
||||
$author_phids = $saved->getParameter('authorPHIDs');
|
||||
$viewer = $this->requireViewer();
|
||||
|
||||
$datasource = id(new PhabricatorTypeaheadUserParameterizedDatasource())
|
||||
->setViewer($viewer);
|
||||
|
||||
$author_phids = $saved->getParameter('authorPHIDs', array());
|
||||
$author_phids = $datasource->evaluateTokens($author_phids);
|
||||
if ($author_phids) {
|
||||
$query->withAuthors($author_phids);
|
||||
}
|
||||
|
||||
$subscriber_phids = $saved->getParameter('subscriberPHIDs');
|
||||
$datasource = id(new PhabricatorMetaMTAMailableFunctionDatasource())
|
||||
->setViewer($viewer);
|
||||
$subscriber_phids = $saved->getParameter('subscriberPHIDs', array());
|
||||
$subscriber_phids = $datasource->evaluateTokens($subscriber_phids);
|
||||
if ($subscriber_phids) {
|
||||
$query->withSubscribers($subscriber_phids);
|
||||
}
|
||||
|
@ -274,13 +283,13 @@ final class ManiphestTaskSearchEngine
|
|||
->setValue($projects))
|
||||
->appendControl(
|
||||
id(new AphrontFormTokenizerControl())
|
||||
->setDatasource(new PhabricatorPeopleDatasource())
|
||||
->setDatasource(new PhabricatorTypeaheadUserParameterizedDatasource())
|
||||
->setName('authors')
|
||||
->setLabel(pht('Authors'))
|
||||
->setValue($author_phids))
|
||||
->appendControl(
|
||||
id(new AphrontFormTokenizerControl())
|
||||
->setDatasource(new PhabricatorMetaMTAMailableDatasource())
|
||||
->setDatasource(new PhabricatorMetaMTAMailableFunctionDatasource())
|
||||
->setName('subscribers')
|
||||
->setLabel(pht('Subscribers'))
|
||||
->setValue($subscriber_phids))
|
||||
|
|
|
@ -41,6 +41,7 @@ final class PhabricatorProjectMembersDatasource
|
|||
$result
|
||||
->setTokenType(PhabricatorTypeaheadTokenView::TYPE_FUNCTION)
|
||||
->setIcon('fa-users')
|
||||
->setColor(null)
|
||||
->setPHID('members('.$result->getPHID().')')
|
||||
->setDisplayName(pht('Members: %s', $result->getDisplayName()))
|
||||
->setName($result->getName().' members');
|
||||
|
|
Loading…
Reference in a new issue