diff options
author | dklawren <dklawren@users.noreply.github.com> | 2017-08-31 16:07:39 +0200 |
---|---|---|
committer | David Walsh <davidwalsh83@gmail.com> | 2017-08-31 16:07:39 +0200 |
commit | 18f98f9c23c427c8a253e8663237fe745eb34538 (patch) | |
tree | 5167495f7251b5cd900ce5ab32380963f461696b /extensions | |
parent | ea91a4d354eb0175a46671a6911bb3dffaebfe75 (diff) | |
download | bugzilla-18f98f9c23c427c8a253e8663237fe745eb34538.tar.gz bugzilla-18f98f9c23c427c8a253e8663237fe745eb34538.tar.xz |
Bug 1395346 - Allow setting obsolete to false for phabricator attachments when a user reclaims a revision (#227)
Diffstat (limited to 'extensions')
-rw-r--r-- | extensions/PhabBugz/lib/WebService.pm | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/extensions/PhabBugz/lib/WebService.pm b/extensions/PhabBugz/lib/WebService.pm index 5668eac81..e09a72036 100644 --- a/extensions/PhabBugz/lib/WebService.pm +++ b/extensions/PhabBugz/lib/WebService.pm @@ -231,10 +231,16 @@ sub obsolete_attachments { ThrowCodeError('param_required', { param => 'bug_id' }) } + my $make_obsolete = $params->{make_obsolete}; + unless (defined $make_obsolete) { + ThrowCodeError('param_required', { param => 'make_obsolete' }) + } + $make_obsolete = $make_obsolete ? 1 : 0; + my $bug = Bugzilla::Bug->check($bug_id); my @attachments = - grep { is_attachment_phab_revision($_) } @{ $bug->attachments() }; + grep { is_attachment_phab_revision($_, 1) } @{ $bug->attachments() }; return { result => [] } if !@attachments; @@ -246,7 +252,7 @@ sub obsolete_attachments { my ($curr_revision_id) = ($attachment->filename =~ PHAB_ATTACHMENT_PATTERN); next if $revision_id != $curr_revision_id; - $attachment->set_is_obsolete(1); + $attachment->set_is_obsolete($make_obsolete); $attachment->update($timestamp); push(@updated_attach_ids, $attachment->id); |