Skip to content

Commit

Permalink
Use the 'Default project' when reporting a new bug
Browse files Browse the repository at this point in the history
When reporting a new issue, if the current project is ALL_PROJECTS and
the user's default project is not ALL_PROJECTS, then we automatically
switch to the user's default project instead of displaying the selection
list.

Fixes #16026
  • Loading branch information
dregad committed Aug 28, 2013
1 parent d88d016 commit 116dfbf
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions bug_report_page.php
Expand Up @@ -134,9 +134,17 @@
$t_project_id = $t_bug->project_id;
} else {
# Get Project Id and set it as current
$t_project_id = gpc_get_int( 'project_id', helper_get_current_project() );
$t_current_project = helper_get_current_project();
$t_project_id = gpc_get_int( 'project_id', $t_current_project );

# If all projects, use default project if set
$t_default_project = user_pref_get_pref( auth_get_current_user_id(), 'default_project' );
if( ALL_PROJECTS == $t_project_id && ALL_PROJECTS != $t_default_project ) {
$t_project_id = $t_default_project;
}

if( ( ALL_PROJECTS == $t_project_id || project_exists( $t_project_id ) )
&& $t_project_id != helper_get_current_project()
&& $t_project_id != $t_current_project
) {
helper_set_current_project( $t_project_id );
# Reloading the page is required so that the project browser
Expand All @@ -145,7 +153,7 @@
}

# New issues cannot be reported for the 'All Project' selection
if ( ( ALL_PROJECTS == helper_get_current_project() ) ) {
if( ALL_PROJECTS == $t_current_project ) {
print_header_redirect( 'login_select_proj_page.php?ref=bug_report_page.php' );
}

Expand Down

0 comments on commit 116dfbf

Please sign in to comment.