mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-19 12:00:55 +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(
|
$saved->setParameter(
|
||||||
'subscriberPHIDs',
|
'subscriberPHIDs',
|
||||||
$this->readPHIDsFromRequest($request, 'subscribers'));
|
$this->readSubscribersFromRequest($request, 'subscribers'));
|
||||||
|
|
||||||
$saved->setParameter(
|
$saved->setParameter(
|
||||||
'statuses',
|
'statuses',
|
||||||
|
@ -111,12 +111,21 @@ final class ManiphestTaskSearchEngine
|
||||||
$query = id(new ManiphestTaskQuery())
|
$query = id(new ManiphestTaskQuery())
|
||||||
->needProjectPHIDs(true);
|
->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) {
|
if ($author_phids) {
|
||||||
$query->withAuthors($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) {
|
if ($subscriber_phids) {
|
||||||
$query->withSubscribers($subscriber_phids);
|
$query->withSubscribers($subscriber_phids);
|
||||||
}
|
}
|
||||||
|
@ -274,13 +283,13 @@ final class ManiphestTaskSearchEngine
|
||||||
->setValue($projects))
|
->setValue($projects))
|
||||||
->appendControl(
|
->appendControl(
|
||||||
id(new AphrontFormTokenizerControl())
|
id(new AphrontFormTokenizerControl())
|
||||||
->setDatasource(new PhabricatorPeopleDatasource())
|
->setDatasource(new PhabricatorTypeaheadUserParameterizedDatasource())
|
||||||
->setName('authors')
|
->setName('authors')
|
||||||
->setLabel(pht('Authors'))
|
->setLabel(pht('Authors'))
|
||||||
->setValue($author_phids))
|
->setValue($author_phids))
|
||||||
->appendControl(
|
->appendControl(
|
||||||
id(new AphrontFormTokenizerControl())
|
id(new AphrontFormTokenizerControl())
|
||||||
->setDatasource(new PhabricatorMetaMTAMailableDatasource())
|
->setDatasource(new PhabricatorMetaMTAMailableFunctionDatasource())
|
||||||
->setName('subscribers')
|
->setName('subscribers')
|
||||||
->setLabel(pht('Subscribers'))
|
->setLabel(pht('Subscribers'))
|
||||||
->setValue($subscriber_phids))
|
->setValue($subscriber_phids))
|
||||||
|
|
|
@ -41,6 +41,7 @@ final class PhabricatorProjectMembersDatasource
|
||||||
$result
|
$result
|
||||||
->setTokenType(PhabricatorTypeaheadTokenView::TYPE_FUNCTION)
|
->setTokenType(PhabricatorTypeaheadTokenView::TYPE_FUNCTION)
|
||||||
->setIcon('fa-users')
|
->setIcon('fa-users')
|
||||||
|
->setColor(null)
|
||||||
->setPHID('members('.$result->getPHID().')')
|
->setPHID('members('.$result->getPHID().')')
|
||||||
->setDisplayName(pht('Members: %s', $result->getDisplayName()))
|
->setDisplayName(pht('Members: %s', $result->getDisplayName()))
|
||||||
->setName($result->getName().' members');
|
->setName($result->getName().' members');
|
||||||
|
|
Loading…
Reference in a new issue