1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-22 23:02:42 +01:00

Allow projects to be queried by slug in "project.search"

Summary:
Ref T13102. See PHI461. An install is interested in querying projects by slug.

I think I omitted this capability originally only because we're not consistent about what slugs are called (they are "Slugs" internally, but "Hashtags" in the UI).

However, this ship has sort of already sailed because the results have a "slug" field. Just expose this as "slugs" for consistency with the existing API field and try to smooth thing over with a little documentation hint.

Test Plan: Queried for projects by slug, got the desired results back.

Maniphest Tasks: T13102

Differential Revision: https://secure.phabricator.com/D19230
This commit is contained in:
epriestley 2018-03-16 12:53:03 -07:00
parent 2b5c73fc3d
commit c216fd4072

View file

@ -23,6 +23,14 @@ final class PhabricatorProjectSearchEngine
id(new PhabricatorSearchTextField())
->setLabel(pht('Name'))
->setKey('name'),
id(new PhabricatorSearchStringListField())
->setLabel(pht('Slugs'))
->setIsHidden(true)
->setKey('slugs')
->setDescription(
pht(
'Search for projects with particular slugs. (Slugs are the same '.
'as project hashtags.)')),
id(new PhabricatorUsersSearchField())
->setLabel(pht('Members'))
->setKey('memberPHIDs')
@ -81,6 +89,10 @@ final class PhabricatorProjectSearchEngine
$query->withNameTokens($tokens);
}
if ($map['slugs']) {
$query->withSlugs($map['slugs']);
}
if ($map['memberPHIDs']) {
$query->withMemberPHIDs($map['memberPHIDs']);
}