diff options
Diffstat (limited to 'extensions')
-rw-r--r-- | extensions/BMO/Extension.pm | 14 | ||||
-rw-r--r-- | extensions/BMO/lib/Data.pm | 3 | ||||
-rw-r--r-- | extensions/BMO/template/en/default/hook/attachment/list-action.html.tmpl | 10 | ||||
-rw-r--r-- | extensions/BugModal/template/en/default/bug_modal/attachments.html.tmpl | 2 | ||||
-rw-r--r-- | extensions/BugModal/web/bug_modal.css | 2 |
5 files changed, 22 insertions, 9 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) = @_; diff --git a/extensions/BMO/lib/Data.pm b/extensions/BMO/lib/Data.pm index d5a87b50a..c799de2aa 100644 --- a/extensions/BMO/lib/Data.pm +++ b/extensions/BMO/lib/Data.pm @@ -28,16 +28,19 @@ our %autodetect_attach_urls = ( title => 'GitHub Pull Request', regex => qr#^https://github\.com/[^/]+/[^/]+/pull/\d+/?$#i, content_type => 'text/x-github-pull-request', + can_review => 1, }, reviewboard => { title => 'MozReview', regex => qr#^https?://reviewboard(?:-dev)?\.(?:allizom|mozilla)\.org/r/\d+/?#i, content_type => 'text/x-review-board-request', + can_review => 1, }, google_docs => { title => 'Google Doc', regex => qr#^https://docs\.google\.com/(?:document|spreadsheets|presentation)/d/#i, content_type => 'text/x-google-doc', + can_review => 0, }, ); diff --git a/extensions/BMO/template/en/default/hook/attachment/list-action.html.tmpl b/extensions/BMO/template/en/default/hook/attachment/list-action.html.tmpl index 9b2463f78..6982b3338 100644 --- a/extensions/BMO/template/en/default/hook/attachment/list-action.html.tmpl +++ b/extensions/BMO/template/en/default/hook/attachment/list-action.html.tmpl @@ -6,7 +6,11 @@ # defined by the Mozilla Public License, v. 2.0. #%] -[% RETURN UNLESS user.in_group("bounty-team") - && attachment.is_bounty_attachment %] +[% IF user.in_group("bounty-team") && attachment.is_bounty_attachment %] + <span id="bounty_attachment"></span> +[% END %] -<span id="bounty_attachment"></span> +[% IF !attachment.ispatch && attachment.can_review %] +   | + <a href="attachment.cgi?id=[% attachment.id FILTER none %]">Review</a> +[% END %] diff --git a/extensions/BugModal/template/en/default/bug_modal/attachments.html.tmpl b/extensions/BugModal/template/en/default/bug_modal/attachments.html.tmpl index ca47047fc..f9d219497 100644 --- a/extensions/BugModal/template/en/default/bug_modal/attachments.html.tmpl +++ b/extensions/BugModal/template/en/default/bug_modal/attachments.html.tmpl @@ -23,7 +23,7 @@ <tr class=" [%~ " bz_private" IF attachment.isprivate %] [%~ " attach-obsolete" IF attachment.isobsolete %] - [%~ " attach-patch" IF attachment.ispatch %] + [%~ " attach-patch" IF attachment.can_review %] " [% IF attachment.isobsolete %]style="display:none"[% END %]> <td class="attach-desc-td"> <div class="attach-desc"> diff --git a/extensions/BugModal/web/bug_modal.css b/extensions/BugModal/web/bug_modal.css index 2f869b453..cb16c8fd7 100644 --- a/extensions/BugModal/web/bug_modal.css +++ b/extensions/BugModal/web/bug_modal.css @@ -427,7 +427,7 @@ input[type="number"] { text-decoration: line-through; } -#attachments .attach-desc-td { +#attachments .attach-patch .attach-desc-td { background: #ffc; background-image: linear-gradient(to right, #ffc, #fff); } |