]> git.ipfire.org Git - thirdparty/bugzilla.git/commitdiff
Bug 1286987 - When the cisco-spark keyword is added to an existing bug, please have...
authorDavid Lawrence <dkl@mozilla.com>
Mon, 25 Jul 2016 18:41:35 +0000 (18:41 +0000)
committerDavid Lawrence <dkl@mozilla.com>
Mon, 25 Jul 2016 18:41:35 +0000 (18:41 +0000)
extensions/Push/lib/Connector/Spark.pm

index a8b5bf056302ee8ac3e81972ccc78c986b3fc41a..548b2ab548de05328eab01e06a5cab25cf6c4344 100644 (file)
@@ -21,7 +21,7 @@ use Bugzilla::Util qw(correct_urlbase);
 
 use JSON qw(decode_json encode_json);
 use LWP::UserAgent;
-use List::MoreUtils qw(none);
+use List::MoreUtils qw(any);
 
 sub options {
     return (
@@ -68,10 +68,14 @@ sub should_send {
         return 1;
     }
     else {
-        # send status and resolution updates
         foreach my $change (@{ $data->{event}->{changes} }) {
-            return 1 if $change->{field} eq 'bug_status'
-                || $change->{field} eq 'resolution';
+            # send status and resolution updates
+            return 1 if $change->{field} eq 'bug_status' || $change->{field} eq 'resolution';
+            # also send if the right keyword has been added to this bug
+            if ($change->{field} eq 'keywords' && $change->{added}) {
+                my @added = split(/, /, $change->{added});
+                return 1 if any { $_ eq 'cisco-spark' } @added;
+            }
         }
     }