View Issue Details

IDProjectCategoryView StatusLast Update
0016028mantisbtapi soappublic2014-02-07 18:24
Reporterkaese Assigned Torombert  
PrioritynormalSeverityminorReproducibilityalways
Status closedResolutionfixed 
Product Version1.2.15 
Target Version1.2.16Fixed in Version1.2.16 
Summary0016028: Adding note via webservice generates wrong email content for assigned user
Description

We are seeing a strange behaviour when updating an existing ticket via webservice.

Lets asume the following:

userX is a MANAGER in ProjectY and userX has an issue assigned to him.

add a note via webinterface: An email is generated for userX, telling him that a new note has been added. The email is send from "My name <from@domain.com>" (as configured). The history is missing from the ticket (as configured)

add a note via webservice: An email is generated for userX, telling him that a new note has been added. The email is send from "Bugtracker <noreplay@domain.com>". The email has a full history of the ticket attached.

it seems like the environment for this email is not correctly initialized, as the value for view_history_threshold is 10 (which is the default value in our setup) .

Steps To Reproduce

see above.

Can be reproduced in our environment.

Additional Information

The project is configured with:

<all users> ProjectY view_history_threshold integer 90 (ADMINISTRATOR)
<all users> ProjectY from_email string from@domain.com
<all users> ProjectY from_name string My name

I tried adding some debug output to core/email_api.php:1149

1447 # put history data
1448 log_event( LOG_EMAIL, "view_history_threshold for user $p_user_id: ".config_get( 'view_history_threshold' ) );
1449 log_event( LOG_EMAIL, "view_history_threshold for user $p_user_id: ".config_get( 'view_history_threshold'));

with the following result:

  • note added via webinterface: view_history_threshold for user 103: 90
  • note added via webservice: view_history_threshold for user 103: 10
TagsNo tags attached.
Attached Files

Activities

rombert

rombert

2013-06-07 08:32

reporter   ~0037136

Please fill in the 'version' field with your MantisBT version.

kaese

kaese

2013-06-07 08:53

reporter   ~0037137

It's already filled (1.2.15), but apart from that I'm not able to modify this issue.

rombert

rombert

2013-06-26 16:52

reporter   ~0037312

I think I know what happens. Can you try the attached patch ( on top of master-1.2.x ) and see if it fixes your problem?

soap-api-set-gprojectoverride-for-the-mcissuenoteadd.patch (1,210 bytes)   
From c23f8c37d3c1a1b237b330155808eaf925ea9723 Wed, 26 Jun 2013 23:51:24 +0300
From: Robert Munteanu <robert@lmn.ro>
Date: Wed, 26 Jun 2013 23:51:12 +0300
Subject: [PATCH] soap api: set $g_project_override for the mc_issue_note_add function


Fixes #16028: Adding note via webservice generates wrong email content
for assigned user 

diff --git a/api/soap/mc_issue_api.php b/api/soap/mc_issue_api.php
index 2dee6ce..f4409d3 100644
--- a/api/soap/mc_issue_api.php
+++ b/api/soap/mc_issue_api.php
@@ -999,6 +999,8 @@
  * @return integer The id of the added note.
  */
 function mc_issue_note_add( $p_username, $p_password, $p_issue_id, $p_note ) {
+	global $g_project_override;
+	
 	$t_user_id = mci_check_login( $p_username, $p_password );
 	if( $t_user_id === false ) {
 		return mci_soap_fault_login_failed();
@@ -1022,6 +1024,8 @@
 	if( !mci_has_readwrite_access( $t_user_id, $t_project_id ) ) {
 		return mci_soap_fault_access_denied( $t_user_id );
 	}
+	
+	$g_project_override = $t_project_id;
 
 	if( !access_has_bug_level( config_get( 'add_bugnote_threshold' ), $p_issue_id, $t_user_id ) ) {
 		return mci_soap_fault_access_denied( $t_user_id, "You do not have access rights to add notes to this issue" );
kaese

kaese

2013-06-27 02:29

reporter   ~0037313

Your patch looks good. After applying we cannot reproduce this issue anymore. Thank you.

rombert

rombert

2013-06-30 15:18

reporter   ~0037347

Thanks for confirming, I think I've covered all cases were the project needs to be overridden.

Related Changesets

MantisBT: master-1.2.x 1d009970

2013-06-26 12:51

rombert


Details Diff
soap api: set $g_project_override for all applicable mc_issue and
mc_project methods

Fixes 0016028: Adding note via webservice generates wrong email content
for assigned user
Affected Issues
0016028
mod - api/soap/mc_issue_api.php Diff File
mod - api/soap/mc_project_api.php Diff File

MantisBT: master c9c03411

2013-06-30 11:17

rombert


Details Diff
soap api: set $g_project_override for all applicable mc_issue and
mc_project methods

Fixes 0016028: Adding note via webservice generates wrong email content
for assigned user

Conflicts:
api/soap/mc_issue_api.php
Affected Issues
0016028
mod - api/soap/mc_issue_api.php Diff File
mod - api/soap/mc_project_api.php Diff File