- Download the last release here.
- Unzip the package into the Mantis root directory.
- Patch the MANTIS_ROOT/core/email_api.php file.
Patching the email_api.php file:
You need to add a require_once statement and update the email_generic function. Before the patch:
function email_generic( $p_bug_id, $p_notify_type, $p_message_id = null, $p_header_optional_params = null ) { $t_ok = true; if ( ON === config_get( 'enable_email_notification' ) ) { ignore_user_abort( true );
# @@@ yarick123: email_collect_recipients(...) will be completely rewritten to provide additional # information such as language, user access,.. # @@@ yarick123:sort recipients list by language to reduce switches between different languages $t_recipients = email_collect_recipients( $p_bug_id, $p_notify_type );
$t_project_id = bug_get_field( $p_bug_id, 'project_id' ); if ( is_array( $t_recipients ) ) { log_event( LOG_EMAIL, sprintf("bug=%d, type=%s, msg=%s, ... " ... implode( '. ', $t_recipients ) ) );
# send email to every recipient foreach ( $t_recipients as $t_user_id => $t_user_email ) { # load (push) user language here as build_visible_bug_data assumes current language lang_push( user_pref_get_language( $t_user_id, $t_project_id ) );
$t_visible_bug_data = email_build_visible_bug_data( $t_user_id, $p_bug_id, $p_message_id ); $t_ok = email_bug_info_to_one_user( $t_visible_bug_data, ... $p_header_optional_params ) && $t_ok; lang_pop(); } } }
return $t_ok; }
After the patch (note: modified line are added after the tag # NNTP Plugin):
function email_generic( $p_bug_id, $p_notify_type, $p_message_id = null, $p_header_optional_params = null ) { $t_ok = true; if ( ON === config_get( 'enable_email_notification' ) ) { ignore_user_abort( true );
# @@@ yarick123: email_collect_recipients(...) will be completely rewritten to provide additional # information such as language, user access,.. # @@@ yarick123:sort recipients list by language to reduce switches between different languages $t_recipients = email_collect_recipients( $p_bug_id, $p_notify_type );
$t_project_id = bug_get_field( $p_bug_id, 'project_id' ); if ( is_array( $t_recipients ) ) { log_event( LOG_EMAIL, sprintf("bug=%d, type=%s, msg=%s, ... " ... implode( '. ', $t_recipients ) ) );
# send email to every recipient foreach ( $t_recipients as $t_user_id => $t_user_email ) { # load (push) user language here as build_visible_bug_data assumes current language lang_push( user_pref_get_language( $t_user_id, $t_project_id ) );
$t_visible_bug_data = email_build_visible_bug_data( $t_user_id, $p_bug_id, $p_message_id ); $t_ok = email_bug_info_to_one_user( $t_visible_bug_data, ... $p_header_optional_params ) && $t_ok; lang_pop(); } } } # NNTP Plugin if ( ON == config_get( 'plugins_nntp_enable', PLUGINS_NNTP_ENABLE_DEFAULT ) ) { $t_project_id = bug_get_field( $p_bug_id, 'project_id' ); $t_user_id = config_get( 'plugins_nntp_user_id', NO_USER ); lang_push( user_pref_get_language( $t_user_id, $t_project_id ) ); $t_visible_bug_data = email_build_visible_bug_data( $t_user_id, $p_bug_id, $p_message_id ); $t_ok = plugins_nntp_send( $t_visible_bug_data, $p_message_id, $t_project_id, $t_user_id, $p_header_optional_params ) && $t_ok; lang_pop(); }
return $t_ok; }
|