From e0acb9462b63fde56b5ed9f45b9cce7387f6e1ac Mon Sep 17 00:00:00 2001 From: David Walsh Date: Wed, 2 Aug 2017 15:16:10 -0500 Subject: Fix #1386675 - Update user comparison in Phabricator push connector --- extensions/Push/lib/Connector/Phabricator.pm | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'extensions/Push/lib') diff --git a/extensions/Push/lib/Connector/Phabricator.pm b/extensions/Push/lib/Connector/Phabricator.pm index 092d63dd3..d72009708 100644 --- a/extensions/Push/lib/Connector/Phabricator.pm +++ b/extensions/Push/lib/Connector/Phabricator.pm @@ -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) { -- cgit v1.2.3-24-g4f1b