]> git.ipfire.org Git - thirdparty/bugzilla.git/commitdiff
Fix #1386675 - Update user comparison in Phabricator push connector
authorDavid Walsh <davidwalsh83@gmail.com>
Wed, 2 Aug 2017 20:16:10 +0000 (15:16 -0500)
committerdklawren <dklawren@users.noreply.github.com>
Wed, 2 Aug 2017 20:16:10 +0000 (16:16 -0400)
extensions/Push/lib/Connector/Phabricator.pm

index 092d63dd3c9cf9f22ac10db3bcf2c2dd1dc339c5..d72009708bcce5826e9d59ede14040ab4c4a73f2 100644 (file)
@@ -26,6 +26,7 @@ use List::Util qw(any);
 
 use constant PHAB_CONTENT_TYPE       => 'text/x-phabricator-request';
 use constant PHAB_ATTACHMENT_PATTERN => qr/^phabricator-D(\d+)/;
+use constant PHAB_BMO_USER_EMAIL     => 'phab-bot@bmo.tld';
 
 sub options {
     return (
@@ -90,10 +91,13 @@ sub send {
             : 'One revision was' )
           . ' made private due to unknown Bugzilla groups.';
 
-        my $user =
-          Bugzilla->set_user(
-            Bugzilla::User->new( { name => 'conduit@mozilla.bugs' } ) );
+        my $user = Bugzilla::User->new( { name => PHAB_BMO_USER_EMAIL } );
+        $user->{groups} = [ Bugzilla::Group->get_all ];
+        $user->{bless_groups} = [ Bugzilla::Group->get_all ];
+        Bugzilla->set_user($user);
+
         $bug->add_comment( $bmo_error_message, { isprivate => 0 } );
+
         my $bug_changes = $bug->update();
         $bug->send_changes($bug_changes);
 
@@ -130,7 +134,7 @@ sub _get_attachment_revisions() {
     my @attachments = grep {
              $_->isobsolete == 0
           && $_->contenttype eq PHAB_CONTENT_TYPE
-          && $_->attacher->login ne 'phab-bot@bmo.tld'
+          && $_->attacher->login eq PHAB_BMO_USER_EMAIL
     } @{ $bug->attachments() };
 
     if (@attachments) {