From: Kohei Yoshino Date: Tue, 19 Mar 2019 21:26:27 +0000 (-0400) Subject: Bug 1535498 - Go directly to the blocklisting form when selecting blocklist policy... X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=ac270247efd5c1a1749b1058f4570fe0e53193e5;p=thirdparty%2Fbugzilla.git Bug 1535498 - Go directly to the blocklisting form when selecting blocklist policy requests on the enter_bug page. --- diff --git a/extensions/BMO/Extension.pm b/extensions/BMO/Extension.pm index 62ea20750..0d110ba49 100644 --- a/extensions/BMO/Extension.pm +++ b/extensions/BMO/Extension.pm @@ -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 diff --git a/extensions/BMO/lib/Data.pm b/extensions/BMO/lib/Data.pm index e1312ea40..ada0155f4 100644 --- a/extensions/BMO/lib/Data.pm +++ b/extensions/BMO/lib/Data.pm @@ -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',}, ); diff --git a/extensions/BMO/template/en/default/bug/create/create-blocklist.html.tmpl b/extensions/BMO/template/en/default/bug/create/create-blocklist.html.tmpl index 4d1bd22c2..852a9753e 100644 --- a/extensions/BMO/template/en/default/bug/create/create-blocklist.html.tmpl +++ b/extensions/BMO/template/en/default/bug/create/create-blocklist.html.tmpl @@ -46,6 +46,18 @@ #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. + + [% PROCESS global/footer.html.tmpl %]