From ecdc583f2a4690cdc2a2c2e5b6eea9ad43df2882 Mon Sep 17 00:00:00 2001 From: Fedor Indutny <79877362+indutny-signal@users.noreply.github.com> Date: Thu, 2 Jun 2022 16:24:35 -0700 Subject: [PATCH] Add debug log url when submitting it to Support --- app/main.ts | 46 +--------------- ts/components/DebugLogWindow.tsx | 14 +++-- ts/test-node/util/createSupportUrl_test.ts | 30 +++++++++++ ts/util/createSupportUrl.ts | 63 ++++++++++++++++++++++ 4 files changed, 104 insertions(+), 49 deletions(-) create mode 100644 ts/test-node/util/createSupportUrl_test.ts create mode 100644 ts/util/createSupportUrl.ts diff --git a/app/main.ts b/app/main.ts index a6d88c6ba..f897df977 100644 --- a/app/main.ts +++ b/app/main.ts @@ -34,6 +34,7 @@ import * as GlobalErrors from './global_errors'; import { setup as setupCrashReports } from './crashReports'; import { setup as setupSpellChecker } from './spell_check'; import { redactAll, addSensitivePath } from '../ts/util/privacy'; +import { createSupportUrl } from '../ts/util/createSupportUrl'; import { missingCaseError } from '../ts/util/missingCaseError'; import { strictAssert } from '../ts/util/assert'; import { consoleLogger } from '../ts/util/consoleLogger'; @@ -914,51 +915,8 @@ ipc.once('ready-for-updates', readyForUpdates); const TEN_MINUTES = 10 * 60 * 1000; setTimeout(readyForUpdates, TEN_MINUTES); -// the support only provides a subset of languages available within the app -// so we have to list them out here and fallback to english if not included - -const SUPPORT_LANGUAGES = [ - 'ar', - 'bn', - 'de', - 'en-us', - 'es', - 'fr', - 'hi', - 'hi-in', - 'hc', - 'id', - 'it', - 'ja', - 'ko', - 'mr', - 'ms', - 'nl', - 'pl', - 'pt', - 'ru', - 'sv', - 'ta', - 'te', - 'tr', - 'uk', - 'ur', - 'vi', - 'zh-cn', - 'zh-tw', -]; - function openContactUs() { - const userLanguage = app.getLocale(); - const language = SUPPORT_LANGUAGES.includes(userLanguage) - ? userLanguage - : 'en-us'; - - // This URL needs a hardcoded language because the '?desktop' is dropped if the page - // auto-redirects to the proper URL - shell.openExternal( - `https://support.signal.org/hc/${language}/requests/new?desktop` - ); + shell.openExternal(createSupportUrl({ locale: app.getLocale() })); } function openJoinTheBeta() { diff --git a/ts/components/DebugLogWindow.tsx b/ts/components/DebugLogWindow.tsx index a4d9745d4..6692ec889 100644 --- a/ts/components/DebugLogWindow.tsx +++ b/ts/components/DebugLogWindow.tsx @@ -12,6 +12,7 @@ import { ToastDebugLogError } from './ToastDebugLogError'; import { ToastLinkCopied } from './ToastLinkCopied'; import { ToastLoadingFullLogs } from './ToastLoadingFullLogs'; import { openLinkInWebBrowser } from '../util/openLinkInWebBrowser'; +import { createSupportUrl } from '../util/createSupportUrl'; import { useEscapeHandling } from '../hooks/useEscapeHandling'; enum LoadState { @@ -126,6 +127,13 @@ export const DebugLogWindow = ({ setToastType(ToastType.Copied); }; + const supportURL = createSupportUrl({ + locale: i18n.getLocale(), + query: { + debugLog: publicLogURL, + }, + }); + return (
@@ -144,11 +152,7 @@ export const DebugLogWindow = ({