Restore "Fix "Create profile" page not supporting dark mode (#8110)" & Fix string defaultValues during sync-metadata (#9220)

Restoring https://github.com/twentyhq/twenty/pull/9185
Also fixing sync-metadata with test values in jsonb

## Test
sync-metadata on existing workspaces should replace colorSchema in both
metadata and workspaceMember tables
This commit is contained in:
Weiko
2024-12-24 15:09:04 +01:00
committed by GitHub
parent e9717603f2
commit 2dcfaeac73
3 changed files with 18 additions and 6 deletions

View File

@ -193,7 +193,7 @@ export class WorkspaceFieldComparator {
if (
(fieldPropertiesToStringify as readonly string[]).includes(property)
) {
fieldPropertiesToUpdateMap[id][property] = JSON.parse(
fieldPropertiesToUpdateMap[id][property] = this.parseJSONOrString(
difference.value,
);
} else {
@ -233,4 +233,16 @@ export class WorkspaceFieldComparator {
return result;
}
private parseJSONOrString(value: string | null): string | object | null {
if (value === null) {
return null;
}
try {
return JSON.parse(value);
} catch {
return value;
}
}
}