1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-22 05:20:56 +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:
epriestley 2015-04-23 05:13:12 -07:00
parent 22e3e35418
commit fcaf56332f
2 changed files with 15 additions and 5 deletions

View file

@ -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))

View file

@ -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');