about summary refs log tree commit diff
path: root/third_party/gerrit/0003-Add-titles-to-CLs-over-HTTP.patch
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--third_party/gerrit/0003-Add-titles-to-CLs-over-HTTP.patch (renamed from third_party/gerrit/0004-Add-titles-to-CLs-over-HTTP.patch)60
1 files changed, 29 insertions, 31 deletions
diff --git a/third_party/gerrit/0004-Add-titles-to-CLs-over-HTTP.patch b/third_party/gerrit/0003-Add-titles-to-CLs-over-HTTP.patch
index 8e78e5f535..d2b3e3541f 100644
--- a/third_party/gerrit/0004-Add-titles-to-CLs-over-HTTP.patch
+++ b/third_party/gerrit/0003-Add-titles-to-CLs-over-HTTP.patch
@@ -1,22 +1,22 @@
-From 32bf13d8316f93828d2ff47ccfca38d4e7a634b1 Mon Sep 17 00:00:00 2001
+From 585077e751107729b7a2dd495a3b17c677a3f528 Mon Sep 17 00:00:00 2001
 From: Luke Granger-Brown <git@lukegb.com>
 Date: Thu, 2 Jul 2020 23:03:02 +0100
-Subject: [PATCH 4/7] Add titles to CLs over HTTP
+Subject: [PATCH 3/3] Add titles to CLs over HTTP
 
 ---
  .../gerrit/httpd/raw/IndexHtmlUtil.java       | 13 +++-
  .../google/gerrit/httpd/raw/IndexServlet.java |  8 ++-
- .../google/gerrit/httpd/raw/StaticModule.java |  6 +-
+ .../google/gerrit/httpd/raw/StaticModule.java |  5 +-
  .../gerrit/httpd/raw/TitleComputer.java       | 67 +++++++++++++++++++
  .../gerrit/httpd/raw/PolyGerritIndexHtml.soy  |  4 +-
- 5 files changed, 90 insertions(+), 8 deletions(-)
+ 5 files changed, 89 insertions(+), 8 deletions(-)
  create mode 100644 java/com/google/gerrit/httpd/raw/TitleComputer.java
 
 diff --git a/java/com/google/gerrit/httpd/raw/IndexHtmlUtil.java b/java/com/google/gerrit/httpd/raw/IndexHtmlUtil.java
-index 8d52f5ad50..a9cfceb3b6 100644
+index ce22ae8e59..952ba1fef4 100644
 --- a/java/com/google/gerrit/httpd/raw/IndexHtmlUtil.java
 +++ b/java/com/google/gerrit/httpd/raw/IndexHtmlUtil.java
-@@ -39,6 +39,7 @@ import java.util.Arrays;
+@@ -40,6 +40,7 @@ import java.util.Arrays;
  import java.util.Collections;
  import java.util.HashMap;
  import java.util.Map;
@@ -24,7 +24,7 @@ index 8d52f5ad50..a9cfceb3b6 100644
  import java.util.Set;
  import java.util.function.Function;
  
-@@ -60,13 +61,14 @@ public class IndexHtmlUtil {
+@@ -61,13 +62,14 @@ public class IndexHtmlUtil {
        String faviconPath,
        Map<String, String[]> urlParameterMap,
        Function<String, SanitizedContent> urlInScriptTagOrdainer,
@@ -41,32 +41,32 @@ index 8d52f5ad50..a9cfceb3b6 100644
      Set<String> enabledExperiments = experimentFeatures.getEnabledExperimentFeatures();
  
      if (!enabledExperiments.isEmpty()) {
-@@ -77,7 +79,9 @@ public class IndexHtmlUtil {
+@@ -78,7 +80,8 @@ public class IndexHtmlUtil {
  
    /** Returns dynamic parameters of {@code index.html}. */
    public static ImmutableMap<String, Object> dynamicTemplateData(
 -      GerritApi gerritApi, String requestedURL) throws RestApiException, URISyntaxException {
-+      GerritApi gerritApi,
-+      String requestedURL,
-+      TitleComputer titleComputer) throws RestApiException, URISyntaxException {
++      GerritApi gerritApi, String requestedURL, TitleComputer titleComputer)
++		  throws RestApiException, URISyntaxException {
      ImmutableMap.Builder<String, Object> data = ImmutableMap.builder();
      Map<String, SanitizedContent> initialData = new HashMap<>();
      Server serverApi = gerritApi.config().server();
-@@ -128,6 +132,9 @@ public class IndexHtmlUtil {
-       // Don't render data
+@@ -131,6 +134,10 @@ public class IndexHtmlUtil {
      }
  
+     data.put("gerritInitialData", initialData);
++
 +    Optional<String> title = titleComputer.computeTitle(requestedURL);
 +    title.ifPresent(s -> data.put("title", s));
 +
-     data.put("gerritInitialData", initialData);
      return data.build();
    }
+ 
 diff --git a/java/com/google/gerrit/httpd/raw/IndexServlet.java b/java/com/google/gerrit/httpd/raw/IndexServlet.java
-index 3f2c2028ae..7861c007df 100644
+index fcb821e5ae..36eb0c990c 100644
 --- a/java/com/google/gerrit/httpd/raw/IndexServlet.java
 +++ b/java/com/google/gerrit/httpd/raw/IndexServlet.java
-@@ -46,13 +46,15 @@ public class IndexServlet extends HttpServlet {
+@@ -48,13 +48,15 @@ public class IndexServlet extends HttpServlet {
    private final ExperimentFeatures experimentFeatures;
    private final SoySauce soySauce;
    private final Function<String, SanitizedContent> urlOrdainer;
@@ -83,7 +83,7 @@ index 3f2c2028ae..7861c007df 100644
      this.canonicalUrl = canonicalUrl;
      this.cdnPath = cdnPath;
      this.faviconPath = faviconPath;
-@@ -67,6 +69,7 @@ public class IndexServlet extends HttpServlet {
+@@ -69,6 +71,7 @@ public class IndexServlet extends HttpServlet {
          (s) ->
              UnsafeSanitizedContentOrdainer.ordainAsSafe(
                  s, SanitizedContent.ContentKind.TRUSTED_RESOURCE_URI);
@@ -91,33 +91,31 @@ index 3f2c2028ae..7861c007df 100644
    }
  
    @Override
-@@ -85,7 +88,8 @@ public class IndexServlet extends HttpServlet {
+@@ -86,7 +89,8 @@ public class IndexServlet extends HttpServlet {
                faviconPath,
                parameterMap,
                urlOrdainer,
--              requestUrl);
-+              requestUrl,
-+              titleComputer);
+-              getRequestUrl(req));
++              getRequestUrl(req),
++	      titleComputer);
        renderer = soySauce.renderTemplate("com.google.gerrit.httpd.raw.Index").setData(templateData);
      } catch (URISyntaxException | RestApiException e) {
        throw new IOException(e);
 diff --git a/java/com/google/gerrit/httpd/raw/StaticModule.java b/java/com/google/gerrit/httpd/raw/StaticModule.java
-index bb1eb92525..6b20c504d2 100644
+index 8e8a9d27f0..a0fb168554 100644
 --- a/java/com/google/gerrit/httpd/raw/StaticModule.java
 +++ b/java/com/google/gerrit/httpd/raw/StaticModule.java
-@@ -224,11 +224,13 @@ public class StaticModule extends ServletModule {
+@@ -226,10 +226,11 @@ public class StaticModule extends ServletModule {
          @CanonicalWebUrl @Nullable String canonicalUrl,
          @GerritServerConfig Config cfg,
          GerritApi gerritApi,
 -        ExperimentFeatures experimentFeatures) {
 +        ExperimentFeatures experimentFeatures,
-+        TitleComputer titleComputer) {
-       String cdnPath =
-           options.useDevCdn() ? options.devCdn() : cfg.getString("gerrit", null, "cdnPath");
++	TitleComputer titleComputer) {
+       String cdnPath = options.devCdn().orElse(cfg.getString("gerrit", null, "cdnPath"));
        String faviconPath = cfg.getString("gerrit", null, "faviconPath");
 -      return new IndexServlet(canonicalUrl, cdnPath, faviconPath, gerritApi, experimentFeatures);
-+      return new IndexServlet(canonicalUrl, cdnPath, faviconPath, gerritApi,
-+          experimentFeatures, titleComputer);
++      return new IndexServlet(canonicalUrl, cdnPath, faviconPath, gerritApi, experimentFeatures, titleComputer);
      }
  
      @Provides
@@ -195,10 +193,10 @@ index 0000000000..8fd2053ad0
 +  }
 +}
 diff --git a/resources/com/google/gerrit/httpd/raw/PolyGerritIndexHtml.soy b/resources/com/google/gerrit/httpd/raw/PolyGerritIndexHtml.soy
-index 11717fb8a4..1ae9046360 100644
+index 8c97a49e81..129092dc7e 100644
 --- a/resources/com/google/gerrit/httpd/raw/PolyGerritIndexHtml.soy
 +++ b/resources/com/google/gerrit/httpd/raw/PolyGerritIndexHtml.soy
-@@ -33,10 +33,12 @@
+@@ -32,10 +32,12 @@
    {@param? defaultDashboardHex: ?}
    {@param? dashboardQuery: ?}
    {@param? userIsAuthenticated: ?}
@@ -213,5 +211,5 @@ index 11717fb8a4..1ae9046360 100644
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=0">{\n}
  
 -- 
-2.32.0
+2.36.0