@@ -644,6 +644,7 @@ sub update {
644644
645645 my @bugs = map { Bugzilla::Bug-> check_for_edit($_ ) } @$ids ;
646646
647+ my $minor_update = delete $params -> {minor_update } ? 1 : 0;
647648 my %values = %$params ;
648649 $values {other_bugs } = \@bugs ;
649650
@@ -677,14 +678,16 @@ sub update {
677678 }
678679
679680 my %all_changes ;
681+ my %minor_updates ;
680682 $dbh -> bz_start_transaction();
681683 foreach my $bug (@bugs ) {
684+ $minor_updates {$bug -> id} = $bug -> has_unsent_changes ? 0 : $minor_update ;
682685 $all_changes {$bug -> id} = $bug -> update();
683686 }
684687 $dbh -> bz_commit_transaction();
685688
686689 foreach my $bug (@bugs ) {
687- $bug -> send_changes($all_changes {$bug -> id});
690+ $bug -> send_changes($all_changes {$bug -> id}, undef , $minor_updates { $bug -> id} );
688691 }
689692
690693 my %api_name = reverse %{ Bugzilla::Bug::FIELD_MAP() };
@@ -820,6 +823,7 @@ sub add_attachment {
820823 || ThrowCodeError(' param_required' , { param => ' data' });
821824
822825 my @bugs = map { Bugzilla::Bug-> check_for_edit($_ ) } @{ $params -> {ids } };
826+ my $minor_update = delete $params -> {minor_update } ? 1 : 0;
823827
824828 my @created ;
825829 $dbh -> bz_start_transaction();
@@ -863,10 +867,17 @@ sub add_attachment {
863867 extra_data => $attachment -> id });
864868 push (@created , $attachment );
865869 }
866- $_ -> bug-> update($timestamp ) foreach @created ;
870+ my %minor_updates ;
871+ foreach my $attachment (@created ) {
872+ my $bug = $attachment -> bug;
873+ $minor_updates {$bug -> id} = $bug -> has_unsent_changes ? 0 : $minor_update ;
874+ $bug -> update($timestamp );
875+ }
867876 $dbh -> bz_commit_transaction();
868877
869- $_ -> send_changes() foreach @bugs ;
878+ foreach my $bug (@bugs ) {
879+ $bug -> send_changes(undef , undef , $minor_updates {$bug -> id});
880+ }
870881
871882 my @created_ids = map { $_ -> id } @created ;
872883
@@ -882,6 +893,7 @@ sub update_attachment {
882893 my $ids = delete $params -> {ids };
883894 defined $ids || ThrowCodeError(' param_required' , { param => ' ids' });
884895
896+ my $req_minor_update = delete $params -> {minor_update } ? 1 : 0;
885897 # Some fields cannot be sent to set_all
886898 foreach my $key (qw( login password token) ) {
887899 delete $params -> {$key };
@@ -967,8 +979,9 @@ sub update_attachment {
967979
968980 # Email users about the change
969981 foreach my $bug (values %bugs ) {
982+ my $minor_update = $bug -> has_unsent_changes ? 0 : $req_minor_update ;
970983 $bug -> update();
971- $bug -> send_changes();
984+ $bug -> send_changes(undef , undef , $minor_update );
972985 }
973986
974987 # Return the information to the user
@@ -989,6 +1002,8 @@ sub add_comment {
9891002 || ThrowCodeError(' param_required' , { param => ' comment' });
9901003
9911004 my $bug = Bugzilla::Bug-> check_for_edit($params -> {id });
1005+ my $minor_update = delete $params -> {minor_update } ? 1 : 0;
1006+ $minor_update = $bug -> has_unsent_changes ? 0 : $minor_update ;
9921007
9931008 # Backwards-compatibility for versions before 3.6
9941009 if (defined $params -> {private }) {
@@ -1007,7 +1022,8 @@ sub add_comment {
10071022 my $new_comment_id = $bug -> {added_comments }[0]-> id;
10081023
10091024 # Send mail.
1010- Bugzilla::BugMail::Send($bug -> bug_id, { changer => $user });
1025+ Bugzilla::BugMail::Send($bug -> bug_id, { changer => $user },
1026+ { minor_update => $minor_update });
10111027
10121028 return { id => $self -> type(' int' , $new_comment_id ) };
10131029}
@@ -1023,6 +1039,7 @@ sub update_see_also {
10231039 my ($add , $remove ) = @$params {qw( add remove) };
10241040 ($add || $remove )
10251041 or ThrowCodeError(' params_required' , { params => [' add' , ' remove' ] });
1042+ my $req_minor_update = delete $params -> {minor_update } ? 1 : 0;
10261043
10271044 my @bugs ;
10281045 foreach my $id (@{ $params -> {ids } }) {
@@ -1038,6 +1055,7 @@ sub update_see_also {
10381055
10391056 my %changes ;
10401057 foreach my $bug (@bugs ) {
1058+ my $minor_update = $bug -> has_unsent_changes ? 0 : $req_minor_update ;
10411059 my $change = $bug -> update();
10421060 if (my $see_also = $change -> {see_also }) {
10431061 $changes {$bug -> id}-> {see_also } = {
@@ -1050,7 +1068,8 @@ sub update_see_also {
10501068 $changes {$bug -> id}-> {see_also } = { added => [], removed => [] };
10511069 }
10521070
1053- Bugzilla::BugMail::Send($bug -> id, { changer => $user });
1071+ Bugzilla::BugMail::Send($bug -> id, { changer => $user },
1072+ { minor_update => $minor_update });
10541073 }
10551074
10561075 return { changes => \%changes };
@@ -3414,6 +3433,12 @@ C<string> The login of the requestee if the flag type is requestable to a specif
34143433
34153434=back
34163435
3436+ =item C<minor_update >
3437+
3438+ C<boolean > If set to true, this is considered a minor update and no mail is sent
3439+ to users who do not want minor update emails. If current user is not in the
3440+ minor_update_group, this parameter is simply ignored.
3441+
34173442=back
34183443
34193444=item B<Returns >
@@ -3609,6 +3634,14 @@ C<boolean> Set to true if you specifically want a new flag to be created.
36093634
36103635=back
36113636
3637+ =item C<minor_update >
3638+
3639+ C<boolean > If set to true, this is considered a minor update and no mail is sent
3640+ to users who do not want minor update emails. If current user is not in the
3641+ minor_update_group, this parameter is simply ignored.
3642+
3643+ =back
3644+
36123645=item B<Returns >
36133646
36143647A C<hash > with a single field, "attachments". This points to an array of hashes
@@ -3729,8 +3762,6 @@ You did not specify a value for the C<summary> argument.
37293762
37303763=back
37313764
3732- =back
3733-
37343765=head2 add_comment
37353766
37363767B<STABLE >
@@ -3771,6 +3802,9 @@ structures, otherwise it is a normal text.
37713802on the bug. If you are not in the time tracking group, this value will
37723803be ignored.
37733804
3805+ =item C<minor_update > (boolean) - If set to true, this is considered a minor update
3806+ and no mail is sent to users who do not want minor update emails. If current user
3807+ is not in the minor_update_group, this parameter is simply ignored.
37743808
37753809=back
37763810
@@ -3872,6 +3906,12 @@ pulled from the URL path.
38723906Array of C<int > s or C<string > s. The ids or aliases of the bugs that
38733907you want to modify.
38743908
3909+ =item C<minor_update >
3910+
3911+ C<boolean > If set to true, this is considered a minor update and no mail is sent
3912+ to users who do not want minor update emails. If current user is not in the
3913+ minor_update_group, this parameter is simply ignored.
3914+
38753915=back
38763916
38773917B<Note > : All following fields specify the values you want to set on the
@@ -4442,6 +4482,12 @@ If you specify a URL that is not in the See Also field of a particular bug,
44424482it will just be silently ignored. Invaild URLs are currently silently ignored,
44434483though this may change in some future version of Bugzilla.
44444484
4485+ =item C<minor_update >
4486+
4487+ C<boolean > If set to true, this is considered a minor update and no mail is sent
4488+ to users who do not want minor update emails. If current user is not in the
4489+ minor_update_group, this parameter is simply ignored.
4490+
44454491=back
44464492
44474493NOTE: If you specify the same URL in both C<add > and C<remove > , it will
0 commit comments