Fix issue where file / link export accidentally included support request details

Summary: When doing a Flipper trace export through the app menu (not the support form), the export still contained a support request details section, with the default data of a bug report. That doesn't make any sense and is confusing, so this change makes sure the report is only included if it is supported through the supportRequestForm

Reviewed By: passy

Differential Revision: D19499408

fbshipit-source-id: ff7a5333f2045f2465966dffa0c5fb03aaeaceb8
This commit is contained in:
Michel Weststrate
2020-01-27 07:20:53 -08:00
committed by Facebook Github Bot
parent 82e65c68dc
commit 6218b00e15
3 changed files with 14 additions and 9 deletions

View File

@@ -580,6 +580,7 @@ export async function getStoreExport(
export async function exportStore(
store: MiddlewareAPI,
includeSupportDetails?: boolean,
idler?: Idler,
statusUpdate?: (msg: string) => void,
): Promise<{serializedString: string; errorArray: Array<Error>}> {
@@ -593,13 +594,15 @@ export async function exportStore(
idler,
);
if (exportData != null) {
exportData.supportRequestDetails = {
...state.supportForm?.supportFormV2,
appName:
state.connections.selectedApp == null
? ''
: deconstructClientId(state.connections.selectedApp).app,
};
if (includeSupportDetails) {
exportData.supportRequestDetails = {
...state.supportForm?.supportFormV2,
appName:
state.connections.selectedApp == null
? ''
: deconstructClientId(state.connections.selectedApp).app,
};
}
statusUpdate && statusUpdate('Serializing Flipper data...');
const serializedString = JSON.stringify(exportData);
@@ -622,10 +625,11 @@ export async function exportStore(
export const exportStoreToFile = (
exportFilePath: string,
store: MiddlewareAPI,
includeSupportDetails: boolean,
idler?: Idler,
statusUpdate?: (msg: string) => void,
): Promise<{errorArray: Array<Error>}> => {
return exportStore(store, idler, statusUpdate).then(
return exportStore(store, includeSupportDetails, idler, statusUpdate).then(
({serializedString, errorArray}) => {
return promisify(fs.writeFile)(exportFilePath, serializedString).then(
() => {