summaryrefslogtreecommitdiffstats
path: root/extensions/BMO/lib
diff options
context:
space:
mode:
authorByron Jones <glob@mozilla.com>2015-03-17 05:13:48 +0100
committerByron Jones <glob@mozilla.com>2015-03-17 05:13:48 +0100
commit2d8badfce2364ffe22bbd8448e7a74bbccba10c7 (patch)
tree004d3896914f5427481192283224809012f1f4a1 /extensions/BMO/lib
parent81f9221bfa9bac2653d569bf4bbf7dbc42a16f98 (diff)
downloadbugzilla-2d8badfce2364ffe22bbd8448e7a74bbccba10c7.tar.gz
bugzilla-2d8badfce2364ffe22bbd8448e7a74bbccba10c7.tar.xz
Bug 1132963: Automatically detect and redirect to Google doc URLs (akin to github-pr and rb handling)
Diffstat (limited to 'extensions/BMO/lib')
-rw-r--r--extensions/BMO/lib/Data.pm22
1 files changed, 18 insertions, 4 deletions
diff --git a/extensions/BMO/lib/Data.pm b/extensions/BMO/lib/Data.pm
index dc091d23c..63d0eb4ad 100644
--- a/extensions/BMO/lib/Data.pm
+++ b/extensions/BMO/lib/Data.pm
@@ -19,11 +19,25 @@ our @EXPORT = qw( $cf_visible_in_products
%product_sec_groups
%create_bug_formats
@default_named_queries
- GITHUB_PR_CONTENT_TYPE
- RB_REQUEST_CONTENT_TYPE );
+ %autodetect_attach_urls );
-use constant GITHUB_PR_CONTENT_TYPE => 'text/x-github-pull-request';
-use constant RB_REQUEST_CONTENT_TYPE => 'text/x-review-board-request';
+# Creating an attachment whose contents is a URL matching one of these regexes
+# will result in the user being redirected to that URL when viewing the
+# attachment.
+our %autodetect_attach_urls = (
+ github_pr => {
+ regex => qr#^https://github\.com/[^/]+/[^/]+/pull/\d+/?$#i,
+ content_type => 'text/x-github-pull-request',
+ },
+ reviewboard => {
+ regex => qr#^https?://reviewboard(?:-dev)?\.(?:allizom|mozilla)\.org/r/\d+/?#i,
+ content_type => 'text/x-review-board-request',
+ },
+ google_docs => {
+ regex => qr#^https://docs\.google\.com/(?:document|spreadsheets|presentation)/d/#i,
+ content_type => 'text/x-google-doc',
+ },
+);
# Which custom fields are visible in which products and components.
#