about summary refs log tree commit diff
path: root/third_party/gerrit/0004-Add-titles-to-CLs-over-HTTP.patch
diff options
context:
space:
mode:
Diffstat (limited to 'third_party/gerrit/0004-Add-titles-to-CLs-over-HTTP.patch')
-rw-r--r--third_party/gerrit/0004-Add-titles-to-CLs-over-HTTP.patch65
1 files changed, 34 insertions, 31 deletions
diff --git a/third_party/gerrit/0004-Add-titles-to-CLs-over-HTTP.patch b/third_party/gerrit/0004-Add-titles-to-CLs-over-HTTP.patch
index a6395b5444..07c527b5fd 100644
--- a/third_party/gerrit/0004-Add-titles-to-CLs-over-HTTP.patch
+++ b/third_party/gerrit/0004-Add-titles-to-CLs-over-HTTP.patch
@@ -1,22 +1,22 @@
-From 97c5e78c42fe70e3f9cd9bc37129700067525967 Mon Sep 17 00:00:00 2001
+From 152fd4ed4cc45d467fd56945debb759870cd53ca 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/6] Add titles to CLs over HTTP
+Subject: [PATCH 4/7] Add titles to CLs over HTTP
 
 ---
  .../gerrit/httpd/raw/IndexHtmlUtil.java       | 13 +++-
- .../google/gerrit/httpd/raw/IndexServlet.java |  7 +-
- .../google/gerrit/httpd/raw/StaticModule.java |  5 +-
+ .../google/gerrit/httpd/raw/IndexServlet.java |  8 ++-
+ .../google/gerrit/httpd/raw/StaticModule.java |  6 +-
  .../gerrit/httpd/raw/TitleComputer.java       | 67 +++++++++++++++++++
  .../gerrit/httpd/raw/PolyGerritIndexHtml.soy  |  4 +-
- 5 files changed, 88 insertions(+), 8 deletions(-)
+ 5 files changed, 90 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 77d02c16d0..3b2cae702a 100644
+index 8d52f5ad50..a9cfceb3b6 100644
 --- a/java/com/google/gerrit/httpd/raw/IndexHtmlUtil.java
 +++ b/java/com/google/gerrit/httpd/raw/IndexHtmlUtil.java
-@@ -38,6 +38,7 @@ import java.util.Arrays;
+@@ -39,6 +39,7 @@ import java.util.Arrays;
  import java.util.Collections;
  import java.util.HashMap;
  import java.util.Map;
@@ -24,7 +24,7 @@ index 77d02c16d0..3b2cae702a 100644
  import java.util.Set;
  import java.util.function.Function;
  
-@@ -58,13 +59,14 @@ public class IndexHtmlUtil {
+@@ -60,13 +61,14 @@ public class IndexHtmlUtil {
        String faviconPath,
        Map<String, String[]> urlParameterMap,
        Function<String, SanitizedContent> urlInScriptTagOrdainer,
@@ -38,10 +38,10 @@ index 77d02c16d0..3b2cae702a 100644
                  canonicalURL, cdnPath, faviconPath, urlParameterMap, urlInScriptTagOrdainer))
 -        .putAll(dynamicTemplateData(gerritApi, requestedURL));
 +        .putAll(dynamicTemplateData(gerritApi, requestedURL, titleComputer));
+     Set<String> enabledExperiments = experimentFeatures.getEnabledExperimentFeatures();
  
-     Set<String> enabledExperiments = experimentData(urlParameterMap);
      if (!enabledExperiments.isEmpty()) {
-@@ -75,7 +77,9 @@ public class IndexHtmlUtil {
+@@ -77,7 +79,9 @@ public class IndexHtmlUtil {
  
    /** Returns dynamic parameters of {@code index.html}. */
    public static ImmutableMap<String, Object> dynamicTemplateData(
@@ -52,7 +52,7 @@ index 77d02c16d0..3b2cae702a 100644
      ImmutableMap.Builder<String, Object> data = ImmutableMap.builder();
      Map<String, SanitizedContent> initialData = new HashMap<>();
      Server serverApi = gerritApi.config().server();
-@@ -126,6 +130,9 @@ public class IndexHtmlUtil {
+@@ -128,6 +132,9 @@ public class IndexHtmlUtil {
        // Don't render data
      }
  
@@ -63,11 +63,11 @@ index 77d02c16d0..3b2cae702a 100644
      return data.build();
    }
 diff --git a/java/com/google/gerrit/httpd/raw/IndexServlet.java b/java/com/google/gerrit/httpd/raw/IndexServlet.java
-index 97d22701de..089ef4725f 100644
+index 3f2c2028ae..7861c007df 100644
 --- a/java/com/google/gerrit/httpd/raw/IndexServlet.java
 +++ b/java/com/google/gerrit/httpd/raw/IndexServlet.java
-@@ -44,12 +44,14 @@ public class IndexServlet extends HttpServlet {
-   private final GerritApi gerritApi;
+@@ -46,13 +46,15 @@ public class IndexServlet extends HttpServlet {
+   private final ExperimentFeatures experimentFeatures;
    private final SoySauce soySauce;
    private final Function<String, SanitizedContent> urlOrdainer;
 +  private TitleComputer titleComputer;
@@ -76,13 +76,14 @@ index 97d22701de..089ef4725f 100644
        @Nullable String canonicalUrl,
        @Nullable String cdnPath,
        @Nullable String faviconPath,
--      GerritApi gerritApi) {
-+      GerritApi gerritApi,
+       GerritApi gerritApi,
+-      ExperimentFeatures experimentFeatures) {
++      ExperimentFeatures experimentFeatures,
 +      TitleComputer titleComputer) {
      this.canonicalUrl = canonicalUrl;
      this.cdnPath = cdnPath;
      this.faviconPath = faviconPath;
-@@ -63,6 +65,7 @@ public class IndexServlet extends HttpServlet {
+@@ -67,6 +69,7 @@ public class IndexServlet extends HttpServlet {
          (s) ->
              UnsafeSanitizedContentOrdainer.ordainAsSafe(
                  s, SanitizedContent.ContentKind.TRUSTED_RESOURCE_URI);
@@ -90,31 +91,33 @@ index 97d22701de..089ef4725f 100644
    }
  
    @Override
-@@ -74,7 +77,7 @@ public class IndexServlet extends HttpServlet {
-       // TODO(hiesel): Remove URL ordainer as parameter once Soy is consistent
-       ImmutableMap<String, Object> templateData =
-           IndexHtmlUtil.templateData(
--              gerritApi, canonicalUrl, cdnPath, faviconPath, parameterMap, urlOrdainer, requestUrl);
-+              gerritApi, canonicalUrl, cdnPath, faviconPath, parameterMap, urlOrdainer, requestUrl, titleComputer);
+@@ -85,7 +88,8 @@ public class IndexServlet extends HttpServlet {
+               faviconPath,
+               parameterMap,
+               urlOrdainer,
+-              requestUrl);
++              requestUrl,
++              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 4b2c8a9733..466fbaa27c 100644
+index cac716feb9..6b17d8ea6f 100644
 --- a/java/com/google/gerrit/httpd/raw/StaticModule.java
 +++ b/java/com/google/gerrit/httpd/raw/StaticModule.java
-@@ -221,11 +221,12 @@ public class StaticModule extends ServletModule {
-     HttpServlet getPolyGerritUiIndexServlet(
+@@ -223,11 +223,13 @@ public class StaticModule extends ServletModule {
          @CanonicalWebUrl @Nullable String canonicalUrl,
          @GerritServerConfig Config cfg,
--        GerritApi gerritApi) {
-+        GerritApi gerritApi,
+         GerritApi gerritApi,
+-        ExperimentFeatures experimentFeatures) {
++        ExperimentFeatures experimentFeatures,
 +        TitleComputer titleComputer) {
        String cdnPath =
            options.useDevCdn() ? options.devCdn() : cfg.getString("gerrit", null, "cdnPath");
        String faviconPath = cfg.getString("gerrit", null, "faviconPath");
--      return new IndexServlet(canonicalUrl, cdnPath, faviconPath, gerritApi);
-+      return new IndexServlet(canonicalUrl, cdnPath, faviconPath, gerritApi, titleComputer);
+-      return new IndexServlet(canonicalUrl, cdnPath, faviconPath, gerritApi, experimentFeatures);
++      return new IndexServlet(canonicalUrl, cdnPath, faviconPath, gerritApi,
++          experimentFeatures, titleComputer);
      }
  
      @Provides
@@ -192,7 +195,7 @@ index 0000000000..8fd2053ad0
 +  }
 +}
 diff --git a/resources/com/google/gerrit/httpd/raw/PolyGerritIndexHtml.soy b/resources/com/google/gerrit/httpd/raw/PolyGerritIndexHtml.soy
-index 31ea7d2175..abadd089b4 100644
+index 93584c6b05..6e6a1e5401 100644
 --- a/resources/com/google/gerrit/httpd/raw/PolyGerritIndexHtml.soy
 +++ b/resources/com/google/gerrit/httpd/raw/PolyGerritIndexHtml.soy
 @@ -33,10 +33,12 @@