]> git.ipfire.org Git - thirdparty/bugzilla.git/commitdiff
Bug 1535498 - Go directly to the blocklisting form when selecting blocklist policy...
authorKohei Yoshino <kohei.yoshino@gmail.com>
Tue, 19 Mar 2019 21:26:27 +0000 (17:26 -0400)
committerGitHub <noreply@github.com>
Tue, 19 Mar 2019 21:26:27 +0000 (17:26 -0400)
extensions/BMO/Extension.pm
extensions/BMO/lib/Data.pm
extensions/BMO/template/en/default/bug/create/create-blocklist.html.tmpl

index 62ea207502ef6eec8f44b698455c58850496239d..0d110ba49a5b77b00b29975a36a7a976b1250f80 100644 (file)
@@ -2344,7 +2344,7 @@ sub enter_bug_start {
       $cgi->param('format_forced', 1);
     }
   }
-  elsif (my $format = forced_format($cgi->param('product'))) {
+  elsif (my $format = forced_format($cgi->param('product'), $cgi->param('component'))) {
     $cgi->param('format', $format);
   }
 
@@ -2389,7 +2389,7 @@ sub _map_groups {
 sub forced_format {
 
   # note: this is also called from the guided bug entry extension
-  my ($product) = @_;
+  my ($product, $component) = @_;
   return undef unless defined $product;
 
   # always work on the correct product name
@@ -2400,6 +2400,9 @@ sub forced_format {
   # check for a forced-format entry
   my $forced = $create_bug_formats{$product->name} || return;
 
+  # check if the form is component-specific
+  return if $forced->{component} && $forced->{component} ne $component;
+
   # should this user be included?
   my $user = Bugzilla->user;
   my $include
index e1312ea40773184013da1994e6d760751bc635f3..ada0155f430b242f6ef3b7f45574415912455344 100644 (file)
@@ -267,6 +267,8 @@ our %create_bug_formats = (
   'developer.mozilla.org' => {'format' => 'mdn',        'include' => 'everyone',},
   'Legal'                 => {'format' => 'legal',      'include' => 'everyone',},
   'Recruiting'            => {'format' => 'recruiting', 'include' => 'everyone',},
+  'Toolkit'               => {'component' => 'Blocklist Policy Requests',
+                              'format' => 'blocklist', 'include' => 'everyone',},
   'Internet Public Policy' => {'format' => 'ipp', 'include' => 'everyone',},
 );
 
index 4d1bd22c241f4fea07ab78ddbc24b686241c7b9e..852a9753e8369e3517da70e34e3d49a7b644a53c 100644 (file)
 #blocklist_form.noscript {
   display: none;
 }
+
+#standard_link {
+  margin-top: 2em;
+}
+
+#standard_link img {
+  vertical-align: middle;
+}
+
+#standard_link a {
+  cursor: pointer;
+}
 [% END %]
 
 [% inline_javascript = BLOCK %]
@@ -101,6 +113,12 @@ function validateAndSubmit() {
 
 window.addEventListener("DOMContentLoaded", function() {
   document.getElementById("blocklist_form").classList.remove("noscript");
+
+  const canonical_path = `${BUGZILLA.config.basepath}form.blocklist`;
+
+  if (location.pathname !== canonical_path) {
+    history.replaceState(null, document.title, canonical_path);
+  }
 });
 
 [% END %]
@@ -228,4 +246,11 @@ window.addEventListener("DOMContentLoaded", function() {
   This form requires JavaScript to be enabled.
 </noscript>
 
+<div id="standard_link">
+  <a href="[% basepath FILTER none %]enter_bug.cgi?product=Toolkit&amp;component=Blocklist%20Policy%20Requests&amp;format=__standard__">
+    <img src="[% basepath FILTER none %]extensions/BMO/web/images/advanced.png" width="16" height="16" border="0">
+    Switch to the standard [% terms.bug %] entry form</a>
+  </a>
+</div>
+
 [% PROCESS global/footer.html.tmpl %]