]> git.ipfire.org Git - thirdparty/bugzilla.git/commitdiff
Bug 1546539 - [SEO] Many legacy and printable bug pages are cached by Google
authorKohei Yoshino <kohei.yoshino@gmail.com>
Wed, 24 Apr 2019 19:16:27 +0000 (15:16 -0400)
committerGitHub <noreply@github.com>
Wed, 24 Apr 2019 19:16:27 +0000 (15:16 -0400)
extensions/BugModal/Extension.pm
extensions/BugModal/template/en/default/bug_modal/edit.html.tmpl
qa/t/test_bug_edit.t
qa/t/test_custom_fields.t
qa/t/test_long_list_redirection.t [deleted file]
template/en/default/bug/navigate.html.tmpl
template/en/default/global/site-navigation.html.tmpl

index 92240cc0407ebafd27af0b5e97bbf30833533ee6..e6064424fc070d1951c1727625250141b65bff1c 100644 (file)
@@ -49,7 +49,17 @@ sub _alternative_show_bug_format {
     return '' if $ctype ne 'html';
   }
   if (my $format = $cgi->param('format')) {
-    return ($format eq '__default__' || $format eq 'default') ? '' : $format;
+    my @ids = $cgi->param('id');
+    # Drop `format=default` as well as `format=multiple`, if a single bug ID is
+    # provided, by redirecting to the modal UI (301 Moved Permanently)
+    if ($format eq '__default__' || $format eq 'default'
+      || ($format eq 'multiple' && scalar(@ids) == 1))
+    {
+      $cgi->base_redirect('show_bug.cgi?id=' . $cgi->param('id'), 1);
+    }
+    # Otherwise, printable `format=multiple` is still available from bug lists
+    # as the Long Format option
+    return $format;
   }
   return $user->setting('ui_experiments') eq 'on' ? 'modal' : '';
 }
index 3976a1085b81bd71f9d65391ba1c0d4d8b2febd0..f162ec5d95aa563fcdd965aa0497aa5f5dd30dd5 100644 (file)
       <button type="button" id="format-btn" aria-haspopup="true" aria-label="Format [% terms.Bug %] Menu"
         aria-expanded="false" aria-controls="format-menu" class="dropdown-button minor">Format [% terms.Bug %] &#9652;</button>
       <ul class="dropdown-content left menu-up" id="format-menu" role="menu" style="display:none;">
-        <li role="presentation">
-          <a href="[% basepath FILTER none %]show_bug.cgi?format=multiple&amp;id=[% bug.id FILTER uri %]" role="menuitem" tabindex="-1">For Printing</a>
-        </li>
         <li role="presentation">
           <a href="[% basepath FILTER none %]show_bug.cgi?ctype=xml&amp;id=[% bug.id FILTER uri %]" role="menuitem" tabindex="-1">XML</a>
         </li>
-        <li role="presentation">
-          <a href="[% basepath FILTER none %]show_bug.cgi?format=default&amp;id=[% bug.id FILTER uri %]" role="menuitem" tabindex="-1">Legacy</a>
-        </li>
         [% IF bug.groups_in.size == 0 %]
           <li role="presentation">
             <a href="[% basepath FILTER none %]rest/bug/[% bug.id FILTER uri %]" role="menuitem" tabindex="-1">JSON</a>
index b9fcd3d93286300089dd1140b0cbe12d03505b91..bf68a24aa740a267914d58e1a9034ec521063288 100644 (file)
@@ -320,7 +320,7 @@ $sel->is_text_present_ok(
   "You are not permitted to edit bugs in product TestProduct.");
 logout($sel);
 
-# Test searches and "format for printing".
+# Test searches.
 
 log_in($sel, $config, 'admin');
 open_advanced_search_page($sel);
@@ -359,17 +359,6 @@ check_page_load($sel, WAIT_TIME,
   q{http://HOSTNAME:8000/buglist.cgi?cmdtype=runnamed&namedcmd=My%20bugs%20from%20QA_Selenium&list_id=17}
 );
 $sel->title_is("Bug List: My bugs from QA_Selenium");
-$sel->click_ok("long_format");
-check_page_load($sel, WAIT_TIME, q{http://HOSTNAME:8000/show_bug.cgi});
-$sel->title_is("Full Text Bug Listing");
-$sel->is_text_present_ok("Bug $bug1_id");
-$sel->is_text_present_ok("Status: CONFIRMED");
-$sel->is_text_present_ok(
-  "Reporter: QA-Selenium-TEST <$config->{QA_Selenium_TEST_user_login}>");
-$sel->is_text_present_ok("Assignee: QA Admin <$config->{admin_user_login}>");
-$sel->is_text_present_ok("Severity: blocker");
-$sel->is_text_present_ok("Priority: Highest");
-$sel->is_text_present_ok("I have no privs, I can only comment");
 logout($sel);
 
 # Let's create a 2nd bug by this user so that we can test mass-change
index 5c0a09e404700466eedb26ecf35459267ee467bf..62fdfaa251c4202e43a6d220845e63dc66d14d81 100644 (file)
@@ -225,12 +225,6 @@ edit_bug_and_return($sel, $bug1_id, $bug_summary);
 $sel->select_ok("bug_status", "IN_QA");
 edit_bug_and_return($sel, $bug1_id, $bug_summary);
 
-$sel->click_ok("link=Format For Printing");
-$sel->wait_for_page_to_load_ok(WAIT_TIME);
-$sel->title_is("Full Text Bug Listing");
-$sel->is_text_present_ok("Freetext$bug1_id: dumbo");
-$sel->is_text_present_ok("List$bug1_id: storage");
-$sel->is_text_present_ok("Status: IN_QA UPSTREAM");
 go_to_bug($sel, $bug2_id);
 $sel->select_ok("cf_qa_list_$bug1_id", "label=storage");
 edit_bug($sel, $bug2_id);
diff --git a/qa/t/test_long_list_redirection.t b/qa/t/test_long_list_redirection.t
deleted file mode 100644 (file)
index 6f4509a..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-#
-# This Source Code Form is "Incompatible With Secondary Licenses", as
-# defined by the Mozilla Public License, v. 2.0.
-
-use strict;
-use warnings;
-use lib qw(lib ../../lib ../../local/lib/perl5);
-use Test::More "no_plan";
-use QA::Util;
-
-my ($sel, $config) = get_selenium();
-
-$sel->open_ok("/long_list.cgi?id=1");
-$sel->title_is("Full Text Bug Listing", "Display bug as format for printing");
-my $text = $sel->get_text('//*[@id="bugzilla-body"]//h1');
-$text =~ s/[\r\n\t\s]+/ /g;
-is($text, 'Bug 1', 'Display bug 1 specifically');
index 7a98297f00a4aa53f0e204e30c23da8a467fb12e..ae368cc26cb24710b215b1185a34edb1a7f8ae46 100644 (file)
 [% PROCESS global/variables.none.tmpl %]
 [% IF bottom_navigator == 1 %]
   <ul class="related_actions">
-    <li><a href="[% basepath FILTER none %]show_bug.cgi?format=multiple&amp;id=
-                [% bug.bug_id FILTER uri %]">Format For Printing</a></li>
-    <li>&nbsp;-&nbsp;<a href="[% basepath FILTER none %]show_bug.cgi?ctype=xml&amp;id=
-                        [% bug.bug_id  FILTER uri %]">XML</a></li>
+    <li><a href="[% basepath FILTER none %]show_bug.cgi?ctype=xml&amp;id=[% bug.bug_id FILTER uri %]">XML</a></li>
     [% IF NOT bug.groups_in.size %]
       <li>&nbsp;-&nbsp;<a href="[% basepath FILTER none %]rest/bug/[% bug.bug_id  FILTER uri %]">JSON</a></li>
     [% END %]
index d95ae68dbd3a8d4f367ceefdb84ecdd434d0559d..31ec0be98fd9368a999cc1d54b819ab0fd2047b0 100644 (file)
@@ -48,8 +48,6 @@
 
       <link rel="Show" title="[% terms.Bug %] Activity"
             href="[% basepath FILTER none %]show_activity.cgi?id=[% bug.bug_id %]">
-      <link rel="Show" title="Printer-Friendly Version"
-            href="[% basepath FILTER none %]show_bug.cgi?format=multiple&amp;id=[% bug.bug_id %]">
   [% END %]