Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cache all needed projects for navbar layout #1156

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 2 additions & 0 deletions core/filter_api.php
Expand Up @@ -1492,6 +1492,8 @@ function filter_get_bug_rows_query_clauses( array $p_filter, $p_project_id = nul
$t_private_and_public_project_ids = array();
$t_limited_projects = array();

# make sure the project rows are cached, as they will be used to check access levels.
project_cache_array_rows( $t_project_ids );
foreach( $t_project_ids as $t_pid ) {
# limit reporters to visible projects
if( ( ON === $t_limit_reporters ) && ( !access_has_project_level( access_threshold_min_level( config_get( 'report_bug_threshold', null, $t_user_id, $t_pid ) ) + 1, $t_pid, $t_user_id ) ) ) {
Expand Down
6 changes: 5 additions & 1 deletion core/layout_api.php
Expand Up @@ -615,9 +615,13 @@ function layout_navbar_button_bar() {
*/
function layout_navbar_projects_list( $p_project_id = null, $p_include_all_projects = true, $p_filter_project_id = null, $p_trace = false, $p_can_report_only = false ) {
$t_user_id = auth_get_current_user_id();

# Cache all needed projects
project_cache_array_rows( user_get_all_accessible_projects( $t_user_id ) );

# Get top level projects
$t_project_ids = user_get_accessible_projects( $t_user_id );
$t_can_report = true;
project_cache_array_rows( $t_project_ids );

if( $p_include_all_projects && $p_filter_project_id !== ALL_PROJECTS ) {
echo ALL_PROJECTS == $p_project_id ? '<li class="active">' : '<li>';
Expand Down