EmailReporting falling back to default_notify_flags

This plugin allows you to report an issue in MantisBT by sending an email to a particular mail account

Moderators: Developer, Contributor

Post Reply
mattchap
Posts: 8
Joined: 17 Dec 2013, 18:43

EmailReporting falling back to default_notify_flags

Post by mattchap »

Hi guys, I've been trying to wrap my head around this one for a while..

Basically what's happening is:
1. User creates a ticket via email. The user/group gets an email response that a ticket was created.
2. User goes into the ticket via the mantis interface and adds a note. The user and group gets an email response that the ticket was updated.
3. The user later responds to the ticket's email. The ticket gets updated in mantis, but the user/group does NOT get an email response.

I did a bit of troubleshooting, and it looks like the plugin is correctly using the notify_flags for the group when creating a new ticket directly in Mantis. However, when responding to a ticket via email, Mantis defaults back to default_notify_flags for All Projects and never sends a mail. The ticket is still getting updated by the plugin correctly, however.

Anybody know what would cause this? This bug is preventing us from using Mantis.

(On a side note - if you take longer than X minutes to write a forum post, you get logged out. Logging back in wipes out what you type.)
SL-Gundam
Posts: 722
Joined: 06 Jul 2011, 14:17

Re: EmailReporting falling back to default_notify_flags

Post by SL-Gundam »

Which version of EmailReporting are you running?
mattchap
Posts: 8
Joined: 17 Dec 2013, 18:43

Re: EmailReporting falling back to default_notify_flags

Post by mattchap »

Thanks for your response.

I'm using Nov 2013 - EmailReporting-0.9.0-DEV.
SL-Gundam
Posts: 722
Joined: 06 Jul 2011, 14:17

Re: EmailReporting falling back to default_notify_flags

Post by SL-Gundam »

Weird

There has been a change in this part here: https://github.com/mantisbt-plugins/Ema ... 39b4b2002b

That should have fixed new issue creations for what you describe but it should not have been necessary for notes... will check this out and get back to you
SL-Gundam
Posts: 722
Joined: 06 Jul 2011, 14:17

Re: EmailReporting falling back to default_notify_flags

Post by SL-Gundam »

I've made an adjustment that might have been the cause of your problems: https://github.com/mantisbt-plugins/Ema ... f78a899687

Could you please test this latest version to see if it fixes your problem?
mattchap
Posts: 8
Joined: 17 Dec 2013, 18:43

Re: EmailReporting falling back to default_notify_flags

Post by mattchap »

Thanks for looking into this.

I tried just inserting that line and trying the source from git, and it gives me the same results. Notes email when added within mantis, but no email when done through the EmailReporting plugin.

2014-01-07 16:04 UTC mail_recipient p_notify_type = bugnote t_threshold_min = 100, t_threshold_max = 02014-01-07 16:04 UTC mail_recipient p_notify_type = bugnote t_threshold_min = 100, t_threshold_max = 0

Let me know what you could use from me for assistance.
mattchap
Posts: 8
Joined: 17 Dec 2013, 18:43

Re: EmailReporting falling back to default_notify_flags

Post by mattchap »

Found the problem - the overwrite was in the wrong place. I added it to the correct place and now it works. Hopefully this fix is the correct way to approach it.

Code: Select all

                if ( $t_bug_id !== FALSE && !bug_is_readonly( $t_bug_id ) )
                {
                        // @TODO@ Disabled for now until we find a good solution on how to handle the reporters possible lack of access permissions
//                      access_ensure_bug_level( config_get( 'add_bugnote_threshold' ), $f_bug_id );

                        $t_project_id = ( ( $p_overwrite_project_id === FALSE ) ? $this->_mailbox[ 'project_id' ] : $p_overwrite_project_id );
                        ERP_set_temporary_overwrite( 'project_override', $t_project_id );
SL-Gundam
Posts: 722
Joined: 06 Jul 2011, 14:17

Re: EmailReporting falling back to default_notify_flags

Post by SL-Gundam »

no the overwrite should not be necessary so there is another issue.

When your are in the MantisBT user interface the project of said issue is not always the active project. So the cause is something else. Although your solution could be a temporary fix if you so wish
SL-Gundam
Posts: 722
Joined: 06 Jul 2011, 14:17

Re: EmailReporting falling back to default_notify_flags

Post by SL-Gundam »

Just tested this fully.

Apparently we do need to use the project_override. MantisBT uses it aswell in the case of bugnotes

Source: bugnote_add.php

Code: Select all

	$t_bug = bug_get( $f_bug_id, true );
	if( $t_bug->project_id != helper_get_current_project() ) {
		# in case the current project is not the same project of the bug we are viewing...
		# ... override the current project. This to avoid problems with categories and handlers lists etc.
		$g_project_override = $t_bug->project_id;
	}
I will make the necessary modifications
mattchap
Posts: 8
Joined: 17 Dec 2013, 18:43

Re: EmailReporting falling back to default_notify_flags

Post by mattchap »

Good catch. I'll keep my code in our dev mantis and update yours once I push my work into our prod instance.

On another note, I'll be working with mantis code for a bit longer, so I might occasionally pop my head in with some bugs or code improvements. :)
Post Reply