From 214ab868845bcfb1e33d6665237451916fec0d25 Mon Sep 17 00:00:00 2001 From: David Pursehouse Date: Mon, 1 Dec 2014 11:48:26 +0900 Subject: [PATCH] Make bug report URL unset by default There are still many issues [1, 2, 3 and more] being reported on the Gerrit issue tracker that are not related to Gerrit at all. These are most likely from users who have blindly clicked through from a Gerrit site that is installed with the defaults. The default URL makes sense on gerrit-review.googlesource.com because it's most likely that users do actually want to report a bug on Gerrit itself. However for most other cases, many users are going to assume that it links to the issue tracker for the project(s) that is/are being reviewed. As an example of this, we see quite a lot of issues being reported from the cyanogenmod review site [4] and the Android open source project's review site [5]. Both of those are set up with the default URL. Instead of defaulting to the Gerrit issue tracker, leave the bug report URL unset if not explicitly specified in the config. This change effects all installations, newly initialized or already existing. The site configuration for gerrit-review.googlesource.com will need to be updated to explicitly configure the bug report URL. [1] http://code.google.com/p/gerrit/issues/detail?id=3037 [2] http://code.google.com/p/gerrit/issues/detail?id=3036 [3] http://code.google.com/p/gerrit/issues/detail?id=3028 [4] http://review.cyanogenmod.org/ [5] https://android-review.googlesource.com/ Change-Id: I5c87d456868c37d9bf4cf42dc2ec93beab3444c4 --- Documentation/config-gerrit.txt | 10 ++++++---- .../java/com/google/gerrit/client/Gerrit.java | 19 +++++++++++-------- .../gerrit/httpd/GerritConfigProvider.java | 4 +--- 3 files changed, 18 insertions(+), 15 deletions(-) diff --git a/Documentation/config-gerrit.txt b/Documentation/config-gerrit.txt index 8e47402bca..3b8d26f2c2 100644 --- a/Documentation/config-gerrit.txt +++ b/Documentation/config-gerrit.txt @@ -1537,15 +1537,17 @@ same host as Gerrit. [[gerrit.reportBugUrl]]gerrit.reportBugUrl:: + -URL to direct users to when they need to report a bug about the -Gerrit service. By default this links to the upstream Gerrit -Code Review's own bug tracker but could be directed to the system -administrator's ticket queue. +URL to direct users to when they need to report a bug. ++ +By default unset, meaning no bug report URL will be displayed. Administrators +should set this to the URL of their issue tracker, if necessary. [[gerrit.reportBugText]]gerrit.reportBugText:: + Text to be displayed in the link to the bug report URL. + +Only used when `gerrit.reportBugUrl` is set. ++ Defaults to "Report Bug". [[gerrit.changeScreen]]gerrit.changeScreen:: diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/Gerrit.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/Gerrit.java index 8e5374cf28..1f33551533 100644 --- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/Gerrit.java +++ b/gerrit-gwtui/src/main/java/com/google/gerrit/client/Gerrit.java @@ -472,14 +472,17 @@ public class Gerrit implements EntryPoint { btmmenu.add(new InlineHTML(M.poweredBy(vs))); - final String reportBugText = getConfig().getReportBugText(); - Anchor a = new Anchor( - reportBugText == null ? C.reportBug() : reportBugText, - getConfig().getReportBugUrl()); - a.setTarget("_blank"); - a.setStyleName(""); - btmmenu.add(new InlineLabel(" | ")); - btmmenu.add(a); + String reportBugUrl = getConfig().getReportBugUrl(); + if (reportBugUrl != null) { + String reportBugText = getConfig().getReportBugText(); + Anchor a = new Anchor( + reportBugText == null ? C.reportBug() : reportBugText, + reportBugUrl); + a.setTarget("_blank"); + a.setStyleName(""); + btmmenu.add(new InlineLabel(" | ")); + btmmenu.add(a); + } btmmenu.add(new InlineLabel(" | ")); btmmenu.add(new InlineLabel(C.keyHelp())); } diff --git a/gerrit-httpd/src/main/java/com/google/gerrit/httpd/GerritConfigProvider.java b/gerrit-httpd/src/main/java/com/google/gerrit/httpd/GerritConfigProvider.java index 2fafa77134..c4ca15d5a9 100644 --- a/gerrit-httpd/src/main/java/com/google/gerrit/httpd/GerritConfigProvider.java +++ b/gerrit-httpd/src/main/java/com/google/gerrit/httpd/GerritConfigProvider.java @@ -148,9 +148,7 @@ class GerritConfigProvider implements Provider { config.setNewFeatures(cfg.getBoolean("gerrit", "enableNewFeatures", true)); - final String reportBugUrl = cfg.getString("gerrit", null, "reportBugUrl"); - config.setReportBugUrl(reportBugUrl != null ? - reportBugUrl : "http://code.google.com/p/gerrit/issues/list"); + config.setReportBugUrl(cfg.getString("gerrit", null, "reportBugUrl")); config.setReportBugText(cfg.getString("gerrit", null, "reportBugText")); final Set fields = new HashSet<>();