]> git.ipfire.org Git - thirdparty/bugzilla.git/commitdiff
Bug 1265392 - Clicking "stop following this bug" also turned off the 'restrict commen...
authorDylan Hardison <dylan@mozilla.com>
Fri, 20 May 2016 20:24:23 +0000 (16:24 -0400)
committerDylan Hardison <dylan@mozilla.com>
Fri, 20 May 2016 20:24:45 +0000 (16:24 -0400)
extensions/RestrictComments/Extension.pm

index 001332a8e945ee32bc24e642caf265805e3d9c98..61a4912b395367d9e3107e614d1221340bdfa7de 100644 (file)
@@ -13,6 +13,7 @@ use warnings;
 use base qw(Bugzilla::Extension);
 
 use Bugzilla::Constants;
+use Bugzilla::Util qw(i_am_webservice);
 
 BEGIN {
     *Bugzilla::Bug::restrict_comments = \&_bug_restrict_comments;
@@ -47,8 +48,9 @@ sub _can_restrict_comments {
 sub object_end_of_set_all {
     my ($self, $args) = @_;
     my $object = $args->{object};
-    if ($self->_can_restrict_comments($object)) {
-        my $input = Bugzilla->input_params;
+    my $input = Bugzilla->input_params;
+    my $update_restrict_comments = !i_am_webservice() || exists $input->{restrict_comments};
+    if ($update_restrict_comments && $self->_can_restrict_comments($object)) {
         $object->set('restrict_comments', $input->{restrict_comments} ? 1 : undef);
     }
 }