diff options
author | dklawren <dklawren@users.noreply.github.com> | 2017-08-30 17:15:14 +0200 |
---|---|---|
committer | David Walsh <davidwalsh83@gmail.com> | 2017-08-30 17:15:14 +0200 |
commit | 6e06bb255acdf53d2bbed3911378bd6859a0e3f0 (patch) | |
tree | 7a0b8caaf25fb968bcf79dd945b29f9dde2a62c9 /extensions/Push/lib | |
parent | a4adf15c47119113ab2e93752042528e15fdecfd (diff) | |
download | bugzilla-6e06bb255acdf53d2bbed3911378bd6859a0e3f0.tar.gz bugzilla-6e06bb255acdf53d2bbed3911378bd6859a0e3f0.tar.xz |
Bug 1393023: Approving a revision creates an r+ flag on the revision attachment in the associated bug (#219)
Approving a revision creates an r+ flag on the revision attachment in the associated bug
* - Working version
- Splits accepted_users on ':' instead of accepting a list (phab issue)
Diffstat (limited to 'extensions/Push/lib')
-rw-r--r-- | extensions/Push/lib/Connector/Phabricator.pm | 35 |
1 files changed, 5 insertions, 30 deletions
diff --git a/extensions/Push/lib/Connector/Phabricator.pm b/extensions/Push/lib/Connector/Phabricator.pm index 2571c6d37..c92df3173 100644 --- a/extensions/Push/lib/Connector/Phabricator.pm +++ b/extensions/Push/lib/Connector/Phabricator.pm @@ -21,9 +21,9 @@ use Bugzilla::User; use Bugzilla::Extension::PhabBugz::Constants; use Bugzilla::Extension::PhabBugz::Util qw( add_comment_to_revision create_private_revision_policy - edit_revision_policy get_bug_role_phids get_revisions_by_ids - intersect is_attachment_phab_revision make_revision_public - make_revision_private); + edit_revision_policy get_attachment_revisions get_bug_role_phids + get_revisions_by_ids intersect is_attachment_phab_revision + make_revision_public make_revision_private); use Bugzilla::Extension::Push::Constants; use Bugzilla::Extension::Push::Util qw(is_public); @@ -77,7 +77,7 @@ sub send { my $phab_error_message = 'Revision is being made private due to unknown Bugzilla groups.'; - my @revisions = $self->_get_attachment_revisions($bug); + my @revisions = get_attachment_revisions($bug); foreach my $revision (@revisions) { add_comment_to_revision( $revision->{phid}, $phab_error_message ); make_revision_private( $revision->{phid} ); @@ -110,7 +110,7 @@ sub send { $subscribers = get_bug_role_phids($bug); } - my @revisions = $self->_get_attachment_revisions($bug); + my @revisions = get_attachment_revisions($bug); foreach my $revision (@revisions) { my $revision_phid = $revision->{phid}; @@ -125,31 +125,6 @@ sub send { return PUSH_RESULT_OK; } -sub _get_attachment_revisions() { - my ( $self, $bug ) = @_; - - my @revisions; - - my @attachments = - grep { is_attachment_phab_revision($_) } @{ $bug->attachments() }; - - if (@attachments) { - my @revision_ids; - foreach my $attachment (@attachments) { - my ($revision_id) = - ( $attachment->filename =~ PHAB_ATTACHMENT_PATTERN ); - next if !$revision_id; - push( @revision_ids, int($revision_id) ); - } - - if (@revision_ids) { - @revisions = get_revisions_by_ids( \@revision_ids ); - } - } - - return @revisions; -} - sub _get_bug_by_data { my ( $self, $data ) = @_; my $bug_data = $self->_get_bug_data($data) || return 0; |