mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-22 05:20:56 +01:00
Use function datasources for a couple more Differential fields
Summary: "Authors" and "Subscribers" convert easily without any extra work. Test Plan: Used both fields; used functions and normal tokens. Reviewers: btrahan Reviewed By: btrahan Subscribers: epriestley Differential Revision: https://secure.phabricator.com/D12556
This commit is contained in:
parent
2a37459a5f
commit
bcb957bc8a
1 changed files with 8 additions and 4 deletions
|
@ -71,11 +71,11 @@ final class DifferentialRevisionSearchEngine
|
|||
->needDrafts(true)
|
||||
->needRelationships(true);
|
||||
|
||||
$datasource = id(new PhabricatorPeopleUserFunctionDatasource())
|
||||
$user_datasource = id(new PhabricatorPeopleUserFunctionDatasource())
|
||||
->setViewer($this->requireViewer());
|
||||
|
||||
$responsible_phids = $saved->getParameter('responsiblePHIDs', array());
|
||||
$responsible_phids = $datasource->evaluateTokens($responsible_phids);
|
||||
$responsible_phids = $user_datasource->evaluateTokens($responsible_phids);
|
||||
if ($responsible_phids) {
|
||||
$query->withResponsibleUsers($responsible_phids);
|
||||
}
|
||||
|
@ -83,6 +83,7 @@ final class DifferentialRevisionSearchEngine
|
|||
$this->setQueryProjects($query, $saved);
|
||||
|
||||
$author_phids = $saved->getParameter('authorPHIDs', array());
|
||||
$author_phids = $user_datasource->evaluateTokens($author_phids);
|
||||
if ($author_phids) {
|
||||
$query->withAuthors($author_phids);
|
||||
}
|
||||
|
@ -92,7 +93,10 @@ final class DifferentialRevisionSearchEngine
|
|||
$query->withReviewers($reviewer_phids);
|
||||
}
|
||||
|
||||
$sub_datasource = id(new PhabricatorMetaMTAMailableFunctionDatasource())
|
||||
->setViewer($this->requireViewer());
|
||||
$subscriber_phids = $saved->getParameter('subscriberPHIDs', array());
|
||||
$subscriber_phids = $sub_datasource->evaluateTokens($subscriber_phids);
|
||||
if ($subscriber_phids) {
|
||||
$query->withCCs($subscriber_phids);
|
||||
}
|
||||
|
@ -146,7 +150,7 @@ final class DifferentialRevisionSearchEngine
|
|||
id(new AphrontFormTokenizerControl())
|
||||
->setLabel(pht('Authors'))
|
||||
->setName('authors')
|
||||
->setDatasource(new PhabricatorPeopleDatasource())
|
||||
->setDatasource(new PhabricatorPeopleUserFunctionDatasource())
|
||||
->setValue($author_phids))
|
||||
->appendControl(
|
||||
id(new AphrontFormTokenizerControl())
|
||||
|
@ -158,7 +162,7 @@ final class DifferentialRevisionSearchEngine
|
|||
id(new AphrontFormTokenizerControl())
|
||||
->setLabel(pht('Subscribers'))
|
||||
->setName('subscribers')
|
||||
->setDatasource(new PhabricatorMetaMTAMailableDatasource())
|
||||
->setDatasource(new PhabricatorMetaMTAMailableFunctionDatasource())
|
||||
->setValue($subscriber_phids))
|
||||
->appendControl(
|
||||
id(new AphrontFormTokenizerControl())
|
||||
|
|
Loading…
Reference in a new issue