From 1d96fa1689470945545ac8e0f239357185e832a7 Mon Sep 17 00:00:00 2001 From: Pami Ketolainen Date: Fri, 13 Mar 2015 14:23:54 -0400 Subject: Bug 1062718 - add the ability to disable sending of mail when updating bugs r=dylan,a=sgreen --- attachment.cgi | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'attachment.cgi') diff --git a/attachment.cgi b/attachment.cgi index 61e6f58d8..7df230d79 100755 --- a/attachment.cgi +++ b/attachment.cgi @@ -511,6 +511,9 @@ sub insert { @obsolete_attachments = Bugzilla::Attachment->validate_obsolete($bug, \@obsolete); } + my $minor_update = $cgi->param('minor_update') ? 1 : 0; + $minor_update = $bug->has_unsent_changes ? 0 : $minor_update; + # Must be called before create() as it may alter $cgi->param('ispatch'). my $content_type = Bugzilla::Attachment::get_content_type(); @@ -586,7 +589,8 @@ sub insert { $vars->{'contenttypemethod'} = $cgi->param('contenttypemethod'); my $recipients = { 'changer' => $user, 'owner' => $owner }; - $vars->{'sent_bugmail'} = Bugzilla::BugMail::Send($bugid, $recipients); + my $params = { 'minor_update' => $minor_update }; + $vars->{'sent_bugmail'} = Bugzilla::BugMail::Send($bugid, $recipients, $params); print $cgi->header(); # Generate and return the UI (HTML page) from the appropriate template. @@ -677,6 +681,9 @@ sub update { my $token = $cgi->param('token'); check_hash_token($token, [$attachment->id, $attachment->modification_time]); + my $minor_update = $cgi->param('minor_update') ? 1 : 0; + $minor_update = $bug->has_unsent_changes ? 0 : $minor_update; + # If the user submitted a comment while editing the attachment, # add the comment to the bug. Do this after having validated isprivate! my $comment = $cgi->param('comment'); @@ -739,7 +746,8 @@ sub update { $vars->{'bugs'} = [$bug]; $vars->{'header_done'} = 1; $vars->{'sent_bugmail'} = - Bugzilla::BugMail::Send($bug->id, { 'changer' => $user }); + Bugzilla::BugMail::Send($bug->id, { 'changer' => $user }, + {'minor_update' => $minor_update }); print $cgi->header(); -- cgit v1.2.3-24-g4f1b