Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: mantisbt/mantisbt
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: f92f1a0a8733
Choose a base ref
...
head repository: mantisbt/mantisbt
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: c7e261e1c4d3
Choose a head ref
  • 3 commits
  • 2 files changed
  • 2 contributors

Commits on Dec 13, 2012

  1. Show all users in assign filter when ALL PROJECTS is selected

    Fixes #10130
    
    Signed-off-by: Damien Regad <damien.regad@merckgroup.com>
    JGuilbaud authored and dregad committed Dec 13, 2012

    Verified

    This commit was signed with the committer’s verified signature. The key has expired.
    dtzWill Will Dietz
    Copy the full SHA
    048dc22 View commit details
  2. Optimise code in print_user_option_list()

    Improve performance of code building the list of users for all projects
    introduced in commit 21746dd.
    
    By using an associative array, the foreach loop to remove duplicates can
    be simplified (no need for an if statement) and we can also remove the
    current user from the list more easily.
    
    Affects issue #10130
    dregad committed Dec 13, 2012

    Verified

    This commit was signed with the committer’s verified signature.
    vcunat Vladimír Čunát
    Copy the full SHA
    dba4f3e View commit details
  3. Removing current user from list built by print_user_option_list()

    Since there is a [myself] value in the list, the current user should be
    removed. This was done for ALL_PROJECTS with the fix for issue #10130,
    but the single-project code still listed the current user.
    
    By moving the code to remove the current user to the foreach loop that
    builds the sort arrays, we ensure that it is removed in both cases.
    dregad committed Dec 13, 2012
    Copy the full SHA
    c7e261e View commit details
Showing with 25 additions and 5 deletions.
  1. +1 −1 core/filter_api.php
  2. +24 −4 core/print_api.php
2 changes: 1 addition & 1 deletion core/filter_api.php
Original file line number Diff line number Diff line change
@@ -2218,7 +2218,7 @@ function filter_draw_selection_area2( $p_page_number, $p_for_screen = true, $p_e
$t_show_build = $t_show_product_version && ( config_get( 'enable_product_build' ) == ON );

# overload handler_id setting if user isn't supposed to see them (ref #6189)
if( !access_has_project_level( config_get( 'view_handler_threshold' ), $t_project_id ) ) {
if( !access_has_any_project( config_get( 'view_handler_threshold' ) ) ) {
$t_filter[FILTER_PROPERTY_HANDLER_ID] = array(
META_FILTER_ANY,
);
28 changes: 24 additions & 4 deletions core/print_api.php
Original file line number Diff line number Diff line change
@@ -244,21 +244,41 @@ function print_captcha_input( $p_field_name ) {
#
# @todo from print_reporter_option_list
function print_user_option_list( $p_user_id, $p_project_id = null, $p_access = ANYBODY ) {
$t_users = array();
$t_current_user = auth_get_current_user_id();

if( null === $p_project_id ) {
$p_project_id = helper_get_current_project();
}

$t_users = project_get_all_user_rows( $p_project_id, $p_access );
if( $p_project_id === ALL_PROJECTS ) {
$t_projects = user_get_accessible_projects( $t_current_user );

# handles ALL_PROJECTS case
# Get list of users having access level for all accessible projects
$t_users_temp = array();
foreach( $t_projects as $t_project_id ) {
$t_project_users_list = project_get_all_user_rows( $t_project_id, $p_access );
$t_users_temp = array_merge( $t_users_temp, $t_project_users_list );
}

# Build list of users as an associative array (to remove duplicates)
foreach( $t_users_temp as $t_user ) {
$t_users[$t_user['id']] = $t_user;
}
} else {
$t_users = project_get_all_user_rows( $p_project_id, $p_access );
}

$t_display = array();
$t_sort = array();
$t_show_realname = ( ON == config_get( 'show_realname' ) );
$t_sort_by_last_name = ( ON == config_get( 'sort_by_last_name' ) );
foreach( $t_users as $t_user ) {
foreach( $t_users as $t_key => $t_user ) {
# Remove current user from the list (there is a "myself" value)
if( $t_user['id'] == $t_current_user ) {
unset( $t_users[$t_key] );
continue;
}

$t_user_name = string_attribute( $t_user['username'] );
$t_sort_name = utf8_strtolower( $t_user_name );
if( $t_show_realname && ( $t_user['realname'] <> '' ) ) {