Skip to content

Commit

Permalink
Fixes #11046: notification emails send to an unassigned user.
Browse files Browse the repository at this point in the history
  • Loading branch information
vboctor committed Dec 16, 2009
1 parent f92e62e commit 77a0fb6
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions core/user_pref_api.php
Expand Up @@ -200,13 +200,15 @@ function user_pref_cache_array_rows( $p_user_id_array, $p_project_id = ALL_PROJE
global $g_cache_user_pref;
$c_user_id_array = array();

# identify the user ids that are not cached already.
foreach( $p_user_id_array as $t_user_id ) {
if( !isset( $g_cache_user_pref[(int) $t_user_id][(int)$p_project_id] ) ) {
$c_user_id_array[(int)$t_user_id] = (int)$t_user_id;
}
}

if( empty( $c_user_id_array ) ) {
# if all users are already cached, then return
if ( empty( $c_user_id_array ) ) {
return;
}

Expand All @@ -219,17 +221,20 @@ function user_pref_cache_array_rows( $p_user_id_array, $p_project_id = ALL_PROJE
$result = db_query_bound( $query, Array( (int)$p_project_id ) );

while( $row = db_fetch_array( $result ) ) {
if( !isset( $g_cache_user_pref[(int) $row['id']] ) ) {
$g_cache_user_pref[(int) $row['id']] = array();
if ( !isset( $g_cache_user_pref[(int) $row['user_id']] ) ) {
$g_cache_user_pref[(int) $row['user_id']] = array();
}
$g_cache_user_pref[(int) $row['id']][(int)$p_project_id] = $row;
unset( $c_user_id_array[(int) $row['id']] );

$g_cache_user_pref[(int) $row['user_id']][(int)$p_project_id] = $row;

# remove found users from required set.
unset( $c_user_id_array[(int) $row['user_id']] );
}

# cache users that are not found as false (i.e. negative cache)
foreach( $c_user_id_array as $t_user_id ) {
$g_cache_user_pref[(int) $t_user_id][(int)$p_project_id] = false;
}
return;
}

/**
Expand Down

0 comments on commit 77a0fb6

Please sign in to comment.