Accommodate project reviewers in Differential search

Summary:
Ref T1279. Two changes to the search/query for Differential:

  - "Reviewers" now accepts users and projects.
  - "Responsible Users" now includes revisions where a project you are a member of is a reviewer.

Test Plan:
  - Searched for project reviewers.
  - Verified that the dashboard now shows reviews which I'm only part of via project membership.

Reviewers: btrahan

Reviewed By: btrahan

CC: aran

Maniphest Tasks: T1279

Differential Revision: https://secure.phabricator.com/D7231
This commit is contained in:
epriestley
2013-10-04 20:41:50 -07:00
parent cf4eb3109e
commit 9434df9d7c
5 changed files with 37 additions and 6 deletions

View File

@@ -254,11 +254,15 @@ abstract class PhabricatorApplicationSearchEngine {
*
* @param AphrontRequest Request to read user PHIDs from.
* @param string Key to read in the request.
* @param list<const> Other permitted PHID types.
* @return list<phid> List of user PHIDs.
*
* @task read
*/
protected function readUsersFromRequest(AphrontRequest $request, $key) {
protected function readUsersFromRequest(
AphrontRequest $request,
$key,
array $allow_types = array()) {
$list = $request->getArr($key, null);
if ($list === null) {
$list = $request->getStrList($key);
@@ -266,9 +270,14 @@ abstract class PhabricatorApplicationSearchEngine {
$phids = array();
$names = array();
$allow_types = array_fuse($allow_types);
$user_type = PhabricatorPHIDConstants::PHID_TYPE_USER;
foreach ($list as $item) {
if (phid_get_type($item) == $user_type) {
$type = phid_get_type($item);
phlog($type);
if ($type == $user_type) {
$phids[] = $item;
} else if (isset($allow_types[$type])) {
$phids[] = $item;
} else {
$names[] = $item;