Skip to content

Commit

Permalink
Fix application of show_assigned_names
Browse files Browse the repository at this point in the history
Fix the validation of show_assigned_names for specific overrides,
instead of checking on only at global level.

Fixes: #23518
  • Loading branch information
cproensa authored and vboctor committed Oct 22, 2017
1 parent 84725ae commit d708a4f
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 7 deletions.
4 changes: 3 additions & 1 deletion core/columns_api.php
Expand Up @@ -1399,7 +1399,9 @@ function print_column_status( BugData $p_bug, $p_columns_target = COLUMNS_TARGET
);

# print handler user next to status
if( $p_bug->handler_id > 0 && ON == config_get( 'show_assigned_names' ) && access_can_see_handler_for_bug( $p_bug ) ) {
if( $p_bug->handler_id > 0
&& ON == config_get( 'show_assigned_names', null, $t_current_user, $p_bug->project_id )
&& access_can_see_handler_for_bug( $p_bug ) ) {
printf( ' (%s)', prepare_user_name( $p_bug->handler_id ) );
}
echo '</div></td>';
Expand Down
18 changes: 12 additions & 6 deletions core/custom_function_api.php
Expand Up @@ -87,6 +87,7 @@ function custom_function_default_changelog_print_issue( $p_issue_id, $p_issue_le
static $s_status;

$t_bug = bug_get( $p_issue_id );
$t_current_user = auth_get_current_user_id();

if( $t_bug->category_id ) {
$t_category_name = category_get_name( $t_bug->category_id );
Expand All @@ -97,18 +98,20 @@ function custom_function_default_changelog_print_issue( $p_issue_id, $p_issue_le
$t_category = is_blank( $t_category_name ) ? '' : '<strong>[' . string_display_line( $t_category_name ) . ']</strong> ';

if( !isset( $s_status[$t_bug->status] ) ) {
$s_status[$t_bug->status] = get_enum_element( 'status', $t_bug->status, auth_get_current_user_id(), $t_bug->project_id );
$s_status[$t_bug->status] = get_enum_element( 'status', $t_bug->status, $t_current_user, $t_bug->project_id );
}

# choose color based on status
$status_label = html_get_status_css_class( $t_bug->status, auth_get_current_user_id(), $t_bug->project_id );
$status_label = html_get_status_css_class( $t_bug->status, $t_current_user, $t_bug->project_id );
$t_status_title = string_attribute( get_enum_element( 'status', bug_get_field( $t_bug->id, 'status' ), $t_bug->project_id ) );;

echo utf8_str_pad( '', $p_issue_level * 36, '&#160;' );
echo '<i class="fa fa-square fa-status-box ' . $status_label . '" title="' . $t_status_title . '"></i> ';
echo string_get_bug_view_link( $p_issue_id );
echo ': <span class="label label-light">', $t_category, '</span> ' , string_display_line_links( $t_bug->summary );
if( $t_bug->handler_id > 0 && ON == config_get( 'show_assigned_names' ) && access_can_see_handler_for_bug( $t_bug ) ) {
if( $t_bug->handler_id > 0
&& ON == config_get( 'show_assigned_names', null, $t_current_user, $t_bug->project_id )
&& access_can_see_handler_for_bug( $t_bug ) ) {
echo ' (', prepare_user_name( $t_bug->handler_id ), ')';
}
echo '<div class="space-2"></div>';
Expand Down Expand Up @@ -136,6 +139,7 @@ function custom_function_default_roadmap_print_issue( $p_issue_id, $p_issue_leve
static $s_status;

$t_bug = bug_get( $p_issue_id );
$t_current_user = auth_get_current_user_id();

if( bug_is_resolved( $p_issue_id ) ) {
$t_strike_start = '<s>';
Expand All @@ -153,18 +157,20 @@ function custom_function_default_roadmap_print_issue( $p_issue_id, $p_issue_leve
$t_category = is_blank( $t_category_name ) ? '' : '<strong>[' . string_display_line( $t_category_name ) . ']</strong> ';

if( !isset( $s_status[$t_bug->status] ) ) {
$s_status[$t_bug->status] = get_enum_element( 'status', $t_bug->status, auth_get_current_user_id(), $t_bug->project_id );
$s_status[$t_bug->status] = get_enum_element( 'status', $t_bug->status, $t_current_user, $t_bug->project_id );
}

# choose color based on status
$status_label = html_get_status_css_class( $t_bug->status, auth_get_current_user_id(), $t_bug->project_id );
$status_label = html_get_status_css_class( $t_bug->status, $t_current_user, $t_bug->project_id );
$t_status_title = string_attribute( get_enum_element( 'status', bug_get_field( $t_bug->id, 'status' ), $t_bug->project_id ) );;

echo utf8_str_pad( '', $p_issue_level * 36, '&#160;' );
echo '<i class="fa fa-square fa-status-box ' . $status_label . '" title="' . $t_status_title . '"></i> ';
echo string_get_bug_view_link( $p_issue_id );
echo ': <span class="label label-light">', $t_category, '</span> ', $t_strike_start, string_display_line_links( $t_bug->summary ), $t_strike_end;
if( $t_bug->handler_id > 0 && ON == config_get( 'show_assigned_names' ) && access_can_see_handler_for_bug( $t_bug ) ) {
if( $t_bug->handler_id > 0
&& ON == config_get( 'show_assigned_names', null, $t_current_user, $t_bug->project_id )
&& access_can_see_handler_for_bug( $t_bug ) ) {
echo ' (', prepare_user_name( $t_bug->handler_id ), ')';
}
echo '<div class="space-2"></div>';
Expand Down

0 comments on commit d708a4f

Please sign in to comment.