View Issue Details

IDProjectCategoryView StatusLast Update
0010101mantisbtemailpublic2009-02-04 04:17
Reporterrjosulli Assigned To 
PrioritynormalSeveritymajorReproducibilityalways
Status newResolutionopen 
Product Version1.1.1 
Summary0010101: notify_flags settings for individual projects not being applied
Description

You cannot have 2 projects where one notifies the reporter of a new mail when it is submitted, and another where the reporter is not.

I may be missing something, but I believe this is a coding error, which I have fixed in our installation. In email_api.php config_get is called on 'notify_flags' when fetching the recipients but the project id for the bug is not used, so the project-based settings can never be fetched.

This is a simple change, email_notify_flag needs to know the bug id to get the project from the bug, so the recipient-gathering function email_collect_recipients needs to pass it in.

Steps To Reproduce

Under "Manage Configuration"->"Email Notifications" you can change who gets notified and under what conditions. If you change the setting on "All Projects" then no settings under an individual project matter, the "All Projects" setting overrides it.

Additional Information

196,197c196,197
< function email_notify_flag( $p_bug_id, $action, $flag ) {
< $t_notify_flags = config_get( 'notify_flags' , null, null, bug_get_field( $p_bug_id, 'project_id' ));

  function email_notify_flag( $action, $flag ) {
          $t_notify_flags = config_get( 'notify_flags' );

217c217
< if ( ON == email_notify_flag( $p_bug_id, $p_notify_type, 'reporter' ) ) {

          if ( ON == email_notify_flag( $p_notify_type, 'reporter' ) ) {

224c224
< if ( ON == email_notify_flag( $p_bug_id,$p_notify_type, 'handler' )) {

          if ( ON == email_notify_flag( $p_notify_type, 'handler' )) {

237c237
< if ( ON == email_notify_flag( $p_bug_id,$p_notify_type, 'monitor' ) ) {

          if ( ON == email_notify_flag( $p_notify_type, 'monitor' ) ) {

258c258
< if ( ON == email_notify_flag( $p_bug_id,$p_notify_type, 'bugnotes' ) ) {

          if ( ON == email_notify_flag( $p_notify_type, 'bugnotes' ) ) {

274,275c274,275
< $t_threshold_min = email_notify_flag( $p_bug_id,$p_notify_type, 'threshold_min' );
< $t_threshold_max = email_notify_flag( $p_bug_id,$p_notify_type, 'threshold_max' );

          $t_threshold_min = email_notify_flag( $p_notify_type, 'threshold_min' );
          $t_threshold_max = email_notify_flag( $p_notify_type, 'threshold_max' );
TagsNo tags attached.

Activities

rjosulli

rjosulli

2009-02-03 11:25

reporter   ~0020775

Last edited: 2009-02-03 11:25

oops... the diff is in the wrong direction: for email_api.php

196,197c196,197
< function email_notify_flag( $action, $flag ) {
< $t_notify_flags = config_get( 'notify_flags' );

  function email_notify_flag( $p_bug_id, $action, $flag ) {
          $t_notify_flags = config_get( 'notify_flags' , null, null, bug_get_field( $p_bug_id, 'project_id' ));

217c217
< if ( ON == email_notify_flag( $p_notify_type, 'reporter' ) ) {

          if ( ON == email_notify_flag( $p_bug_id, $p_notify_type, 'reporter' ) ) {

224c224
< if ( ON == email_notify_flag( $p_notify_type, 'handler' )) {

          if ( ON == email_notify_flag( $p_bug_id,$p_notify_type, 'handler' )) {

237c237
< if ( ON == email_notify_flag( $p_notify_type, 'monitor' ) ) {

          if ( ON == email_notify_flag( $p_bug_id,$p_notify_type, 'monitor' ) ) {

258c258
< if ( ON == email_notify_flag( $p_notify_type, 'bugnotes' ) ) {

          if ( ON == email_notify_flag( $p_bug_id,$p_notify_type, 'bugnotes' ) ) {

274,275c274,275
< $t_threshold_min = email_notify_flag( $p_notify_type, 'threshold_min' );
< $t_threshold_max = email_notify_flag( $p_notify_type, 'threshold_max' );

          $t_threshold_min = email_notify_flag( $p_bug_id,$p_notify_type, 'threshold_min' );
          $t_threshold_max = email_notify_flag( $p_bug_id,$p_notify_type, 'threshold_max' );
rjosulli

rjosulli

2009-02-03 12:02

reporter   ~0020777

Having had a look at the code, it would probably be better to pass in the project id as it is already fetched in email_collect_recipients.

olegos

olegos

2009-02-04 01:34

reporter   ~0020779

I believe the existing mechanism for using bug's project for config options is to set $g_project_override, and use helper_get_current_project() to retrieve the project, which will use $g_project_override if set (config_get() should already be doing this). Except see bug 0010060.

rjosulli

rjosulli

2009-02-04 04:17

reporter   ~0020782

Last edited: 2009-02-04 04:17

That's a code mechanism though right? Or at least a config option that (should) have an effect everywhere it occurs.

The problem outlined in this issue is non-conformance with the documentation (as I read it) - which shouldn't require a config or code change. Though, having looked at the code, setting that variable will have no effect as you point out in bug http://www.mantisbt.org/bugs/view.php?id=10060