From bbe3bd112d2be6874f0c8d54a7066743c1ed3b2a Mon Sep 17 00:00:00 2001 From: Francesco Lodolo Date: Thu, 19 Sep 2024 14:38:06 +0200 Subject: [PATCH] VPN: fix links to source file when showing results for all projects (#1043) --- app/classes/Transvision/VersionControl.php | 7 +++++++ tests/units/Transvision/VersionControl.php | 6 ++++++ 2 files changed, 13 insertions(+) diff --git a/app/classes/Transvision/VersionControl.php b/app/classes/Transvision/VersionControl.php index 731d75c1..fcaaa69e 100644 --- a/app/classes/Transvision/VersionControl.php +++ b/app/classes/Transvision/VersionControl.php @@ -137,6 +137,13 @@ public static function gitPath($locale, $repo, $path) return "https://github.com/{$git_repo}/blob/{$git_branch}/{$file_path}"; } + if ($repo == 'vpn_client') { + if ($locale == 'en_US') { + $locale = 'en'; + } + + return "https://github.com/{$git_repo}/blob/{$git_branch}/{$locale}/{$file_path}"; + } } else { $file_path = $path; $git_repo = $repo; diff --git a/tests/units/Transvision/VersionControl.php b/tests/units/Transvision/VersionControl.php index bbfe1f7d..377c2e6e 100644 --- a/tests/units/Transvision/VersionControl.php +++ b/tests/units/Transvision/VersionControl.php @@ -170,6 +170,12 @@ public function getPathDP() 'vpn_client/mozillavpn.xliff.xliff:0f4d892c', 'https://github.com/mozilla-l10n/mozilla-vpn-client-l10n/blob/main/sv_SE/mozillavpn.xliff.xliff', ], + [ + 'en-US', + 'vpn_client', + 'vpn_client/mozillavpn.xliff.xliff:0f4d892c', + 'https://github.com/mozilla-l10n/mozilla-vpn-client-l10n/blob/main/en/mozillavpn.xliff.xliff', + ], ]; }