summaryrefslogtreecommitdiffstats
path: root/extensions/BMO/Extension.pm
diff options
context:
space:
mode:
authorByron Jones <glob@mozilla.com>2015-10-19 16:25:15 +0200
committerByron Jones <glob@mozilla.com>2015-10-19 16:25:15 +0200
commit0ce40b991790cd7695f289b27237b8f2751e5f9b (patch)
tree20adb737898b112b2896cf899ee2237ecbcb0cf4 /extensions/BMO/Extension.pm
parenta0fcc8ff20fe57bf442402ba227954ffb33a2175 (diff)
downloadbugzilla-0ce40b991790cd7695f289b27237b8f2751e5f9b.tar.gz
bugzilla-0ce40b991790cd7695f289b27237b8f2751e5f9b.tar.xz
Bug 1146780 - treat github and mozreview attachments as patches
Diffstat (limited to 'extensions/BMO/Extension.pm')
-rw-r--r--extensions/BMO/Extension.pm14
1 files changed, 10 insertions, 4 deletions
diff --git a/extensions/BMO/Extension.pm b/extensions/BMO/Extension.pm
index 16caecc9a..6e04c2637 100644
--- a/extensions/BMO/Extension.pm
+++ b/extensions/BMO/Extension.pm
@@ -79,6 +79,7 @@ BEGIN {
*Bugzilla::Attachment::is_bounty_attachment = \&_attachment_is_bounty_attachment;
*Bugzilla::Attachment::bounty_details = \&_attachment_bounty_details;
*Bugzilla::Attachment::external_redirect = \&_attachment_external_redirect;
+ *Bugzilla::Attachment::can_review = \&_attachment_can_review;
}
sub template_before_process {
@@ -824,10 +825,7 @@ sub _bug_has_current_patch {
my ($self) = @_;
foreach my $attachment (@{ $self->attachments }) {
next if $attachment->isobsolete;
- return 1 if
- $attachment->ispatch
- || $attachment->contenttype eq 'text/x-github-pull-request'
- || $attachment->contenttype eq 'text/x-review-board-request';
+ return 1 if $attachment->can_review;
}
return 0;
}
@@ -1062,6 +1060,14 @@ sub _attachment_external_redirect {
return _detect_attached_url($self->data)
}
+sub _attachment_can_review {
+ my ($self) = @_;
+
+ return 1 if $self->ispatch;
+ my $external = $self->external_redirect // return;
+ return $external->{can_review};
+}
+
# redirect automatically to github urls
sub attachment_view {
my ($self, $args) = @_;