summaryrefslogtreecommitdiffstats
path: root/extensions/MozReview/Extension.pm
diff options
context:
space:
mode:
authorMark Côté <mcote@mozilla.com>2015-03-06 05:33:39 +0100
committerMark Côté <mcote@mozilla.com>2015-03-09 17:14:07 +0100
commitc25b318fc741b8b65a769446df6179a45b58b04e (patch)
tree066f3d0bc7e7daa792b8ed251cc00c34ee7cc96a /extensions/MozReview/Extension.pm
parentb199f4960471ec9156f9c1ae2f165159d80f30df (diff)
downloadbugzilla-c25b318fc741b8b65a769446df6179a45b58b04e.tar.gz
bugzilla-c25b318fc741b8b65a769446df6179a45b58b04e.tar.xz
Bug 1140049 - Advertise MozReview on Create New Attachment page. r=glob
Diffstat (limited to 'extensions/MozReview/Extension.pm')
-rw-r--r--extensions/MozReview/Extension.pm30
1 files changed, 19 insertions, 11 deletions
diff --git a/extensions/MozReview/Extension.pm b/extensions/MozReview/Extension.pm
index 2287a2136..ab7afb18a 100644
--- a/extensions/MozReview/Extension.pm
+++ b/extensions/MozReview/Extension.pm
@@ -22,25 +22,33 @@ sub template_before_process {
my $vars = $args->{'vars'};
return unless (($file eq 'bug/show-header.html.tmpl' ||
- $file eq 'bug/edit.html.tmpl') &&
+ $file eq 'bug/edit.html.tmpl' ||
+ $file eq 'attachment/create.html.tmpl') &&
Bugzilla->params->{mozreview_base_url});
my $bug = exists $vars->{'bugs'} ? $vars->{'bugs'}[0] : $vars->{'bug'};
if ($bug) {
- my @rrids;
- my $attachments = Bugzilla::Attachment->get_attachments_by_bug($bug);
+ if ($file eq 'attachment/create.html.tmpl') {
+ if ($bug->product eq 'Core' || $bug->product eq 'Firefox' ||
+ $bug->product eq 'Firefox for Android') {
+ $vars->{'mozreview_enabled'} = 1;
+ }
+ } else {
+ my @rrids;
+ my $attachments = Bugzilla::Attachment->get_attachments_by_bug($bug);
- foreach my $attachment (@$attachments) {
- if ($attachment->contenttype eq 'text/x-review-board-request' &&
- !$attachment->isobsolete) {
- push @rrids, ($attachment->data =~ m#/r/(\d+)/?$#);
+ foreach my $attachment (@$attachments) {
+ if ($attachment->contenttype eq 'text/x-review-board-request'
+ && !$attachment->isobsolete) {
+ push @rrids, ($attachment->data =~ m#/r/(\d+)/?$#);
+ }
}
- }
- if (scalar @rrids) {
- $vars->{'mozreview'} = 1;
- $vars->{'review_request_ids'} = \@rrids;
+ if (scalar @rrids) {
+ $vars->{'mozreview'} = 1;
+ $vars->{'review_request_ids'} = \@rrids;
+ }
}
}
}