]> git.ipfire.org Git - thirdparty/bugzilla.git/commitdiff
Bug 1490901 - ReviewBoard stub attachments no longer make a redirect, download a...
authordklawren <dklawren@users.noreply.github.com>
Mon, 17 Sep 2018 21:51:18 +0000 (17:51 -0400)
committerDylan William Hardison <dylan@hardison.net>
Mon, 17 Sep 2018 21:51:18 +0000 (17:51 -0400)
extensions/BMO/lib/Data.pm

index ed576f1a5c69d2b3a996c0d7c761f6a2be4c73bd..349f880931c80c57d6dbf91ec3f12f80f9cad51b 100644 (file)
@@ -27,6 +27,21 @@ our @EXPORT = qw( $cf_visible_in_products
 # will result in the user being redirected to that URL when viewing the
 # attachment.
 
+my $mozreview_url_re = qr{
+    # begins with mozreview hostname
+    ^
+    https?://reviewboard(?:-dev)?\.(?:allizom|mozilla)\.org
+
+    # followed by a review path
+    /r/\d+
+
+    # ends with optional suffix
+    (?: /
+      | /diff/\#index_header
+    )?
+    $
+}ix;
+
 sub phabricator_url_re {
     my $phab_uri = Bugzilla->params->{phabricator_base_uri} || 'https://example.com';
     return qr/^\Q${phab_uri}\ED\d+$/i;
@@ -39,6 +54,12 @@ our %autodetect_attach_urls = (
         content_type => 'text/x-github-pull-request',
         can_review   => 1,
     },
+    reviewboard => {
+        title        => 'MozReview',
+        regex        => $mozreview_url_re,
+        content_type => 'text/x-review-board-request',
+        can_review   => 0,
+    },
     Phabricator => {
         title        => 'Phabricator',
         regex        => \&phabricator_url_re,