diff options
author | Luke Granger-Brown <git@lukegb.com> | 2020-07-02T22·28+0100 |
---|---|---|
committer | lukegb <lukegb@tvl.fyi> | 2020-07-03T18·18+0000 |
commit | 3f6518ce99de8d8fa330ae551b2dc49b2094c712 (patch) | |
tree | 57d8abbcfb7225f1360e0d69446817df3ebfe3f1 /third_party/gerrit | |
parent | 26bb34823d884a619985cf91262f180e0ad4d207 (diff) |
fix(gerrit): return HTML titles in more cases r/1199
At present, we don't return HTML titles if there's a trailing slash, or a patchset. Instead, just consume the / and anything after it. This also fixes /123, because this is HTTP redirected to the full path *with a trailing slash* which otherwise wouldn't get the title injected. Change-Id: Idfd0e67752880a37dce0b400a3c1cfc53fac2912 Reviewed-on: https://cl.tvl.fyi/c/depot/+/859 Reviewed-by: BuildkiteCI Reviewed-by: tazjin <mail@tazj.in> Tested-by: BuildkiteCI
Diffstat (limited to 'third_party/gerrit')
-rw-r--r-- | third_party/gerrit/0001-Use-detzip-in-download_bower.py.patch (renamed from third_party/gerrit/use_detzip.patch) | 12 | ||||
-rw-r--r-- | third_party/gerrit/0002-Syntax-highlight-nix.patch (renamed from third_party/gerrit/syntax_highlight_nix.patch) | 16 | ||||
-rw-r--r-- | third_party/gerrit/0003-Syntax-highlight-rules.pl.patch (renamed from third_party/gerrit/syntax_highlight_rules_pl.patch) | 18 | ||||
-rw-r--r-- | third_party/gerrit/0004-Add-titles-to-CLs-over-HTTP.patch (renamed from third_party/gerrit/add_titles_to_cls.patch) | 21 | ||||
-rw-r--r-- | third_party/gerrit/default.nix | 8 |
5 files changed, 64 insertions, 11 deletions
diff --git a/third_party/gerrit/use_detzip.patch b/third_party/gerrit/0001-Use-detzip-in-download_bower.py.patch index 068bce77176c..c24505d3bf5d 100644 --- a/third_party/gerrit/use_detzip.patch +++ b/third_party/gerrit/0001-Use-detzip-in-download_bower.py.patch @@ -1,3 +1,12 @@ +From aa4cda172a61eb4f09759cba98f4645fe74753a9 Mon Sep 17 00:00:00 2001 +From: Luke Granger-Brown <git@lukegb.com> +Date: Thu, 2 Jul 2020 23:02:09 +0100 +Subject: [PATCH 1/4] Use detzip in download_bower.py + +--- + tools/js/download_bower.py | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + diff --git a/tools/js/download_bower.py b/tools/js/download_bower.py index 1df4b826bc..65bda74082 100755 --- a/tools/js/download_bower.py @@ -11,3 +20,6 @@ index 1df4b826bc..65bda74082 100755 cwd=bc) if args.s: +-- +2.25.1 + diff --git a/third_party/gerrit/syntax_highlight_nix.patch b/third_party/gerrit/0002-Syntax-highlight-nix.patch index 2a7791c756d7..82b5bde13b62 100644 --- a/third_party/gerrit/syntax_highlight_nix.patch +++ b/third_party/gerrit/0002-Syntax-highlight-nix.patch @@ -1,8 +1,17 @@ +From f14cba31f2a9a75d06e58fd6313cc60d0cf5e690 Mon Sep 17 00:00:00 2001 +From: Luke Granger-Brown <git@lukegb.com> +Date: Thu, 2 Jul 2020 23:02:32 +0100 +Subject: [PATCH 2/4] Syntax highlight nix + +--- + .../app/elements/diff/gr-syntax-layer/gr-syntax-layer.js | 1 + + 1 file changed, 1 insertion(+) + diff --git a/polygerrit-ui/app/elements/diff/gr-syntax-layer/gr-syntax-layer.js b/polygerrit-ui/app/elements/diff/gr-syntax-layer/gr-syntax-layer.js -index 1a0bbd9f50..0f2786a911 100644 +index f1e930f177..cc937cff67 100644 --- a/polygerrit-ui/app/elements/diff/gr-syntax-layer/gr-syntax-layer.js +++ b/polygerrit-ui/app/elements/diff/gr-syntax-layer/gr-syntax-layer.js -@@ -99,6 +99,7 @@ const LANGUAGE_MAP = { +@@ -101,6 +101,7 @@ const LANGUAGE_MAP = { 'text/x-vhdl': 'vhdl', 'text/x-yaml': 'yaml', 'text/vbscript': 'vbscript', @@ -10,3 +19,6 @@ index 1a0bbd9f50..0f2786a911 100644 }; const ASYNC_DELAY = 10; +-- +2.25.1 + diff --git a/third_party/gerrit/syntax_highlight_rules_pl.patch b/third_party/gerrit/0003-Syntax-highlight-rules.pl.patch index ccc59b6b46b4..e85cbb9db20a 100644 --- a/third_party/gerrit/syntax_highlight_rules_pl.patch +++ b/third_party/gerrit/0003-Syntax-highlight-rules.pl.patch @@ -1,8 +1,17 @@ +From c3603950e5ae377514febbebf9aa26c31e07cd5d Mon Sep 17 00:00:00 2001 +From: Luke Granger-Brown <git@lukegb.com> +Date: Thu, 2 Jul 2020 23:02:43 +0100 +Subject: [PATCH 3/4] Syntax highlight rules.pl + +--- + .../elements/diff/gr-syntax-layer/gr-syntax-layer.js | 10 ++++++++++ + 1 file changed, 10 insertions(+) + diff --git a/polygerrit-ui/app/elements/diff/gr-syntax-layer/gr-syntax-layer.js b/polygerrit-ui/app/elements/diff/gr-syntax-layer/gr-syntax-layer.js -index 1a0bbd9f50..d8d2fa643b 100644 +index cc937cff67..2145bc169b 100644 --- a/polygerrit-ui/app/elements/diff/gr-syntax-layer/gr-syntax-layer.js +++ b/polygerrit-ui/app/elements/diff/gr-syntax-layer/gr-syntax-layer.js -@@ -102,6 +102,10 @@ const LANGUAGE_MAP = { +@@ -105,6 +105,10 @@ const LANGUAGE_MAP = { }; const ASYNC_DELAY = 10; @@ -13,7 +22,7 @@ index 1a0bbd9f50..d8d2fa643b 100644 const CLASS_WHITELIST = { 'gr-diff gr-syntax gr-syntax-attr': true, 'gr-diff gr-syntax gr-syntax-attribute': true, -@@ -233,10 +237,16 @@ class GrSyntaxLayer extends GestureEventListeners( +@@ -236,10 +240,16 @@ class GrSyntaxLayer extends GestureEventListeners( } } @@ -30,3 +39,6 @@ index 1a0bbd9f50..d8d2fa643b 100644 LANGUAGE_MAP[diffFileMetaInfo.content_type]; } +-- +2.25.1 + diff --git a/third_party/gerrit/add_titles_to_cls.patch b/third_party/gerrit/0004-Add-titles-to-CLs-over-HTTP.patch index 1a17e6dbb7df..bf372add84b9 100644 --- a/third_party/gerrit/add_titles_to_cls.patch +++ b/third_party/gerrit/0004-Add-titles-to-CLs-over-HTTP.patch @@ -1,3 +1,17 @@ +From ead56bd63491ba4fd3c24fb1e9af36a3fa2141bf 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/4] Add titles to CLs over HTTP + +--- + .../gerrit/httpd/raw/IndexHtmlUtil.java | 14 +++- + .../google/gerrit/httpd/raw/IndexServlet.java | 7 +- + .../google/gerrit/httpd/raw/StaticModule.java | 5 +- + .../gerrit/httpd/raw/TitleComputer.java | 67 +++++++++++++++++++ + .../gerrit/httpd/raw/PolyGerritIndexHtml.soy | 4 +- + 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 41d2f83975..323567b4a4 100644 --- a/java/com/google/gerrit/httpd/raw/IndexHtmlUtil.java @@ -109,7 +123,7 @@ index 414a120194..e1b6fb082d 100644 @Provides diff --git a/java/com/google/gerrit/httpd/raw/TitleComputer.java b/java/com/google/gerrit/httpd/raw/TitleComputer.java new file mode 100644 -index 0000000000..efee24607c +index 0000000000..8fd2053ad0 --- /dev/null +++ b/java/com/google/gerrit/httpd/raw/TitleComputer.java @@ -0,0 +1,67 @@ @@ -159,7 +173,7 @@ index 0000000000..efee24607c + return Optional.empty(); + } + -+ private static final Pattern extractChangeIdRegex = Pattern.compile("^/(?:c/.*/\\+/)?(?<changeId>[0-9]+)(?:/[0-9]+)?$"); ++ private static final Pattern extractChangeIdRegex = Pattern.compile("^/(?:c/.*/\\+/)?(?<changeId>[0-9]+)(?:/[0-9]+)?(?:/.*)?$"); + private final Provider<ChangesCollection> changes; + + private Optional<Change.Id> tryExtractChange(String path) { @@ -198,3 +212,6 @@ index d162714399..0ba228ad00 100644 <meta name="referrer" content="never">{\n} <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=0">{\n} +-- +2.25.1 + diff --git a/third_party/gerrit/default.nix b/third_party/gerrit/default.nix index d5350d3ed825..8b7e9678e96d 100644 --- a/third_party/gerrit/default.nix +++ b/third_party/gerrit/default.nix @@ -40,10 +40,10 @@ pkgs.buildBazelPackage { fetchSubmodules = true; }; patches = [ - ./use_detzip.patch - ./syntax_highlight_nix.patch - ./syntax_highlight_rules_pl.patch - ./add_titles_to_cls.patch + ./0001-Use-detzip-in-download_bower.py.patch + ./0002-Syntax-highlight-nix.patch + ./0003-Syntax-highlight-rules.pl.patch + ./0004-Add-titles-to-CLs-over-HTTP.patch ]; bazelTarget = "release"; |