Skip to content

Commit

Permalink
Use case insensitive comparison for filter type and return only unres…
Browse files Browse the repository at this point in the history
…olved issues for assigned to filter.
  • Loading branch information
vboctor committed May 3, 2013
1 parent 9e05727 commit f6618b5
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 9 deletions.
15 changes: 9 additions & 6 deletions api/soap/mc_project_api.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,18 @@
* @param $p_username logged in user name.
* @param $p_password login password.
* @param $p_project_id id of project to filter on, or ALL_PROJECTS.
* @param $p_filter_type The name of the filter to apply ("assigned", "reported", "monitored").
* @param $p_filter_type The name of the filter to apply
* "assigned" - unresolved issues that are assigned to user or unassigned issues (user id 0).
* "reported" - issues that are reported by user.
* "monitored" - issues monitored by user.
* @param $p_target_user ObjectRef for target user, can include id, name, or both.
* @param $p_page_number the page to return (1 based).
* @param $p_per_page number of issues per page.
* @return IssueDataArray a page of matching issues.
*/
function mc_project_get_issues_for_user( $p_username, $p_password, $p_project_id, $p_filter_type, $p_target_user, $p_page_number, $p_per_page ) {
$t_user_id = mci_check_login( $p_username, $p_password );
if( $t_user_id === false ) {
if ( $t_user_id === false ) {
return mci_soap_fault_login_failed();
}

Expand All @@ -41,11 +44,11 @@ function mc_project_get_issues_for_user( $p_username, $p_password, $p_project_id
$t_target_user_id = mci_get_user_id( $p_target_user );
$t_show_sticky = true;

if ( $p_filter_type == 'assigned' ) {
$t_filter = filter_create_assigned_to( $p_project_id, $t_target_user_id );
} else if ( $p_filter_type == 'reported') {
if ( strcasecmp( $p_filter_type, 'assigned' ) == 0 ) {
$t_filter = filter_create_assigned_to_unresolved( $p_project_id, $t_target_user_id );
} else if ( strcasecmp( $p_filter_type, 'reported' ) == 0 ) {
$t_filter = filter_create_reported_by( $p_project_id, $t_target_user_id );
} else if ( $p_filter_type == 'monitored' ) {
} else if ( strcasecmp( $p_filter_type, 'monitored' ) == 0 ) {
$t_filter = filter_create_monitored_by( $p_project_id, $t_target_user_id );
} else {
return SoapObjectsFactory::newSoapFault( 'Client', "Unknown filter type '$p_filter_type'." );
Expand Down
9 changes: 7 additions & 2 deletions core/filter_api.php
Original file line number Diff line number Diff line change
Expand Up @@ -4776,12 +4776,14 @@ function filter_name_valid_length( $p_name ) {
}

/**
* Create a filter for getting issues assigned to the specified project and user.
* Create a filter for getting issues assigned to the specified project and user that
* are not yet resolved.
*
* @param $p_project_id the project id or ALL_PROJECTS.
* @param $p_user_id the user id or 0 to get unassigned issues.
* @return a valid filter.
*/
function filter_create_assigned_to( $p_project_id, $p_user_id ) {
function filter_create_assigned_to_unresolved( $p_project_id, $p_user_id ) {
$t_filter = filter_get_default();

if ( $p_user_id == 0 ) {
Expand All @@ -4790,6 +4792,9 @@ function filter_create_assigned_to( $p_project_id, $p_user_id ) {
$t_filter[FILTER_PROPERTY_HANDLER_ID] = array( '0' => $p_user_id );
}

$t_bug_resolved_status_threshold = config_get( 'bug_resolved_status_threshold' );
$t_filter[FILTER_PROPERTY_HIDE_STATUS_ID] = array( '0' => $t_bug_resolved_status_threshold );

if ( $p_project_id != ALL_PROJECTS ) {
$t_filter[FILTER_PROPERTY_PROJECT_ID] = array( '0' => $p_project_id );
}
Expand Down
2 changes: 1 addition & 1 deletion my_view_inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
$t_hide_status_default = config_get( 'hide_status_default' );
$t_default_show_changed = config_get( 'default_show_changed' );

$c_filter['assigned'] = filter_create_assigned_to( helper_get_current_project(), $t_current_user_id );
$c_filter['assigned'] = filter_create_assigned_to_unresolved( helper_get_current_project(), $t_current_user_id );
$url_link_parameters['assigned'] = FILTER_PROPERTY_HANDLER_ID . '=' . $t_current_user_id . '&' . FILTER_PROPERTY_HIDE_STATUS_ID . '=' . $t_bug_resolved_status_threshold;

$c_filter['recent_mod'] = array(
Expand Down

0 comments on commit f6618b5

Please sign in to comment.