From 31e6b942f257e12813e6c52509e6a390efebb8c7 Mon Sep 17 00:00:00 2001 From: Faye Duxovni Date: Wed, 26 Jan 2022 14:30:45 -0500 Subject: [PATCH] Redirect UISI autorageshakes to separate repo and add more labels for filtering (#7598) This adds a new key `uisi_autorageshake_app` to config.json, holding an optional custom app name for UISI autorageshakes so that the rageshake server can file them separately from user-submitted rageshakes. --- src/components/views/dialogs/BugReportDialog.tsx | 4 ++-- src/rageshake/submit-rageshake.ts | 11 +++++++---- src/stores/AutoRageshakeStore.ts | 6 ++++-- 3 files changed, 13 insertions(+), 8 deletions(-) diff --git a/src/components/views/dialogs/BugReportDialog.tsx b/src/components/views/dialogs/BugReportDialog.tsx index 3ba5b2e46e..1125a7d33c 100644 --- a/src/components/views/dialogs/BugReportDialog.tsx +++ b/src/components/views/dialogs/BugReportDialog.tsx @@ -96,7 +96,7 @@ export default class BugReportDialog extends React.Component { userText, sendLogs: true, progressCallback: this.sendProgressCallback, - label: this.props.label, + labels: [this.props.label], }).then(() => { if (!this.unmounted) { this.props.onFinished(false); @@ -128,7 +128,7 @@ export default class BugReportDialog extends React.Component { await downloadBugReport({ sendLogs: true, progressCallback: this.downloadProgressCallback, - label: this.props.label, + labels: [this.props.label], }); this.setState({ diff --git a/src/rageshake/submit-rageshake.ts b/src/rageshake/submit-rageshake.ts index 5fdca27fa0..4822a9039c 100644 --- a/src/rageshake/submit-rageshake.ts +++ b/src/rageshake/submit-rageshake.ts @@ -28,10 +28,11 @@ import SettingsStore from "../settings/SettingsStore"; import SdkConfig from "../SdkConfig"; interface IOpts { - label?: string; + labels?: string[]; userText?: string; sendLogs?: boolean; progressCallback?: (s: string) => void; + customApp?: string; customFields?: Record; } @@ -67,7 +68,7 @@ async function collectBugReport(opts: IOpts = {}, gzipLogs = true) { const body = new FormData(); body.append('text', opts.userText || "User did not supply any additional text."); - body.append('app', 'element-web'); + body.append('app', opts.customApp || 'element-web'); body.append('version', version); body.append('user_agent', userAgent); body.append('installed_pwa', installedPWA); @@ -120,8 +121,10 @@ async function collectBugReport(opts: IOpts = {}, gzipLogs = true) { } } - if (opts.label) { - body.append('label', opts.label); + if (opts.labels) { + for (const label of opts.labels) { + body.append('label', label); + } } // add labs options diff --git a/src/stores/AutoRageshakeStore.ts b/src/stores/AutoRageshakeStore.ts index 958c1e4635..737c04f509 100644 --- a/src/stores/AutoRageshakeStore.ts +++ b/src/stores/AutoRageshakeStore.ts @@ -98,7 +98,8 @@ export default class AutoRageshakeStore extends AsyncStoreWithClient { const rageshakeURL = await sendBugReport(SdkConfig.get().bug_report_endpoint_url, { userText: "Auto-reporting decryption error (recipient)", sendLogs: true, - label: "Z-UISI", + labels: ["Z-UISI", "web", "uisi-recipient"], + customApp: SdkConfig.get().uisi_autorageshake_app, customFields: { "auto_uisi": JSON.stringify(eventInfo) }, }); @@ -123,7 +124,8 @@ export default class AutoRageshakeStore extends AsyncStoreWithClient { await sendBugReport(SdkConfig.get().bug_report_endpoint_url, { userText: `Auto-reporting decryption error (sender)\nRecipient rageshake: ${recipientRageshake}`, sendLogs: true, - label: "Z-UISI", + labels: ["Z-UISI", "web", "uisi-sender"], + customApp: SdkConfig.get().uisi_autorageshake_app, customFields: { "recipient_rageshake": recipientRageshake, "auto_uisi": JSON.stringify(messageContent),