Skip to content

Commit

Permalink
Don't send a user more than one mention email
Browse files Browse the repository at this point in the history
If a user is mentioned in multiple fields, e.g. summary and description,
only notify them once.
  • Loading branch information
vboctor committed Apr 28, 2016
1 parent 15a1ace commit 8e849c2
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions core/email_api.php
Expand Up @@ -1328,6 +1328,7 @@ function email_user_mention( $p_bug_id, $p_recipients, $p_message = '' ) {
$t_subject = sprintf( lang_get( 'mentioned_in' ), $t_subject );
$t_date = date( config_get( 'normal_date_format' ) );
$t_user_id = auth_get_current_user_id();
$t_users_processed = array();

$t_result = array();
foreach( $p_recipients as $t_recipient ) {
Expand All @@ -1336,6 +1337,13 @@ function email_user_mention( $p_bug_id, $p_recipients, $p_message = '' ) {
continue;
}

# Don't process a user more than once
if( isset( $t_users_processed[$t_recipient] ) ) {
continue;
}

$t_users_processed[$t_recipient] = true;

lang_push( user_pref_get_language( $t_recipient, $t_project_id ) );

$t_email = user_get_email( $t_recipient );
Expand Down

0 comments on commit 8e849c2

Please sign in to comment.