1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-19 12:00:55 +01:00

Allow Maniphest filtering by "upforgrabs" explicitly

Summary:
Allow you to filter by "upforgrabs" to find unassigned tasks.

Test Plan:
Filtered by "upforgrabs".

Reviewed By: tuomaspelkonen
Reviewers: tuomaspelkonen, jungejason, aran
Commenters: aran
CC: sandra, anjali, aran, tuomaspelkonen, epriestley
Differential Revision: 365
This commit is contained in:
epriestley 2011-05-28 14:13:12 -07:00
parent e3a02f7945
commit 10c6fcb4bb
11 changed files with 82 additions and 11 deletions

View file

@ -268,6 +268,7 @@ phutil_register_library_map(array(
'ManiphestTaskEditController' => 'applications/maniphest/controller/taskedit',
'ManiphestTaskListController' => 'applications/maniphest/controller/tasklist',
'ManiphestTaskListView' => 'applications/maniphest/view/tasklist',
'ManiphestTaskOwner' => 'applications/maniphest/constants/owner',
'ManiphestTaskPriority' => 'applications/maniphest/constants/priority',
'ManiphestTaskStatus' => 'applications/maniphest/constants/status',
'ManiphestTaskSummaryView' => 'applications/maniphest/view/tasksummary',

View file

@ -0,0 +1,23 @@
<?php
/*
* Copyright 2011 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
final class ManiphestTaskOwner {
const OWNER_UP_FOR_GRABS = 'PHID-!!!!-UP-FOR-GRABS';
}

View file

@ -0,0 +1,10 @@
<?php
/**
* This file is automatically generated. Lint this module to rebuild it.
* @generated
*/
phutil_require_source('ManiphestTaskOwner.php');

View file

@ -113,9 +113,10 @@ class ManiphestTaskListController extends ManiphestController {
$form->appendChild(
id(new AphrontFormTokenizerControl())
->setLimit(1)
->setDatasource('/typeahead/common/users/')
->setDatasource('/typeahead/common/searchowner/')
->setName('view_user')
->setLabel('View User')
->setCaption('Use "upforgrabs" to find unassigned tasks.')
->setValue(
array(
$view_phid => $handles[$view_phid]->getFullName(),
@ -211,6 +212,14 @@ class ManiphestTaskListController extends ManiphestController {
private function loadTasks($view_phid, array $dict) {
$phids = array($view_phid);
$include_upforgrabs = false;
foreach ($phids as $key => $phid) {
if ($phid == ManiphestTaskOwner::OWNER_UP_FOR_GRABS) {
unset($phids[$key]);
$include_upforgrabs = true;
}
}
$task = new ManiphestTask();
$argv = array();
@ -229,16 +238,39 @@ class ManiphestTaskListController extends ManiphestController {
$extra_clause = '1 = 1';
switch ($this->view) {
case 'action':
$extra_clause = 'ownerPHID in (%Ls)';
$argv[] = $phids;
$parts = array();
if ($phids) {
$parts[] = 'ownerPHID in (%Ls)';
$argv[] = $phids;
}
if ($include_upforgrabs) {
$parts[] = 'ownerPHID IS NULL';
}
$extra_clause = '('.implode(' OR ', $parts).')';
break;
case 'created':
$extra_clause = 'authorPHID in (%Ls)';
$argv[] = $phids;
$parts = array();
if ($phids) {
$parts[] = 'authorPHID in (%Ls)';
$argv[] = $phids;
}
if ($include_upforgrabs) {
// This should be impossible since every task is supposed to have a
// valid author, but we might as well run the query.
$parts[] = 'authorPHID IS NULL';
}
$extra_clause = '('.implode(' OR ', $parts).')';
break;
case 'triage':
$extra_clause = 'ownerPHID in (%Ls) AND priority = %d';
$argv[] = $phids;
$parts = array();
if ($phids) {
$parts[] = 'ownerPHID in (%Ls)';
$argv[] = $phids;
}
if ($include_upforgrabs) {
$parts[] = 'ownerPHID IS NULL';
}
$extra_clause = '('.implode(' OR ', $parts).') AND priority = %d';
$argv[] = ManiphestTaskPriority::PRIORITY_TRIAGE;
break;
case 'alltriage':

View file

@ -7,6 +7,7 @@
phutil_require_module('phabricator', 'aphront/response/redirect');
phutil_require_module('phabricator', 'applications/maniphest/constants/owner');
phutil_require_module('phabricator', 'applications/maniphest/constants/priority');
phutil_require_module('phabricator', 'applications/maniphest/constants/status');
phutil_require_module('phabricator', 'applications/maniphest/controller/base');

View file

@ -94,8 +94,9 @@ class PhabricatorObjectHandleData {
$handle->setPHID($phid);
$handle->setType($type);
switch ($phid) {
case 'PHID-!!!!-UP-FOR-GRABS':
case ManiphestTaskOwner::OWNER_UP_FOR_GRABS:
$handle->setName('Up For Grabs');
$handle->setFullName('upforgrabs (Up For Grabs)');
break;
default:
$handle->setName('Foul Magicks');

View file

@ -7,6 +7,7 @@
phutil_require_module('phabricator', 'applications/files/uri');
phutil_require_module('phabricator', 'applications/maniphest/constants/owner');
phutil_require_module('phabricator', 'applications/phid/constants');
phutil_require_module('phabricator', 'applications/phid/handle');
phutil_require_module('phabricator', 'applications/repository/constants/repositorytype');

View file

@ -100,7 +100,7 @@ class PhabricatorSearchManiphestIndexer
} else {
$doc->addRelationship(
PhabricatorSearchRelationship::RELATIONSHIP_OWNER,
'PHID-!!!!-UP-FOR-GRABS',
ManiphestTaskOwner::OWNER_UP_FOR_GRABS,
PhabricatorPHIDConstants::PHID_TYPE_MAGIC,
$owner
? $owner->getDateCreated()

View file

@ -6,6 +6,7 @@
phutil_require_module('phabricator', 'applications/maniphest/constants/owner');
phutil_require_module('phabricator', 'applications/maniphest/constants/status');
phutil_require_module('phabricator', 'applications/maniphest/constants/transactiontype');
phutil_require_module('phabricator', 'applications/maniphest/storage/transaction');

View file

@ -63,9 +63,9 @@ class PhabricatorTypeaheadCommonDatasourceController
if ($need_upforgrabs) {
$data[] = array(
'Up For Grabs',
'upforgrabs (Up For Grabs)',
null,
'PHID-!!!!-UP-FOR-GRABS',
ManiphestTaskOwner::OWNER_UP_FOR_GRABS,
);
}

View file

@ -7,6 +7,7 @@
phutil_require_module('phabricator', 'aphront/response/ajax');
phutil_require_module('phabricator', 'applications/maniphest/constants/owner');
phutil_require_module('phabricator', 'applications/metamta/storage/mailinglist');
phutil_require_module('phabricator', 'applications/owners/storage/package');
phutil_require_module('phabricator', 'applications/people/storage/user');