1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2025-03-28 04:00:17 +01:00

Convert "Created By" and "Invited" inputs in Calendar search to use PhabricatorPeopleUserFunctionDatasource

Summary: Closes T8046, Convert "Created By" and "Invited" inputs in Calendar search to use `PhabricatorPeopleUserFunctionDatasource`

Test Plan: {nav Calendar > Advanced Search}, search for "members:Calendar", created by and invited. Should autofill and search correctly.

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: epriestley, Korvin

Maniphest Tasks: T8046

Differential Revision: https://secure.phabricator.com/D13311
This commit is contained in:
lkassianik 2015-06-16 13:38:11 -07:00
parent 2a5cf5e1b7
commit 05066f649b

View file

@ -58,6 +58,9 @@ final class PhabricatorCalendarEventSearchEngine
$min_range = $this->getDateFrom($saved)->getEpoch();
$max_range = $this->getDateTo($saved)->getEpoch();
$user_datasource = id(new PhabricatorPeopleUserFunctionDatasource())
->setViewer($viewer);
if ($this->isMonthView($saved) ||
$this->isDayView($saved)) {
list($start_year, $start_month, $start_day) =
@ -124,11 +127,13 @@ final class PhabricatorCalendarEventSearchEngine
}
$invited_phids = $saved->getParameter('invitedPHIDs');
$invited_phids = $user_datasource->evaluateTokens($invited_phids);
if ($invited_phids) {
$query->withInvitedPHIDs($invited_phids);
}
$creator_phids = $saved->getParameter('creatorPHIDs');
$creator_phids = $user_datasource->evaluateTokens($creator_phids);
if ($creator_phids) {
$query->withCreatorPHIDs($creator_phids);
}
@ -196,13 +201,13 @@ final class PhabricatorCalendarEventSearchEngine
$form
->appendControl(
id(new AphrontFormTokenizerControl())
->setDatasource(new PhabricatorPeopleDatasource())
->setDatasource(new PhabricatorPeopleUserFunctionDatasource())
->setName('creators')
->setLabel(pht('Created By'))
->setValue($creator_phids))
->appendControl(
id(new AphrontFormTokenizerControl())
->setDatasource(new PhabricatorPeopleDatasource())
->setDatasource(new PhabricatorPeopleUserFunctionDatasource())
->setName('invited')
->setLabel(pht('Invited'))
->setValue($invited_phids))