Serialize 'disabledProfileSources' (#9038)
"disabledProfileSources" is saved to `CascadiaSettings` _not_ `GlobalAppSettings` (and, even then, it's only read when it's used, never saved). This PR specifically detects if it was defined in settings.json, and copies it over when the settings are serialized. ## Validation Steps Performed 1. Added "disabledProfileSources" to settings.json, then serialized. --> "disabledProfileSources" is now maintained. 2. Updated `CascadiaSettings` serialization test Closes #9032
This commit is contained in:
parent
40e328984d
commit
230fad533e
|
@ -226,6 +226,7 @@ namespace SettingsModelLocalTests
|
|||
const std::string settingsString{ R"({
|
||||
"$schema": "https://aka.ms/terminal-profiles-schema",
|
||||
"defaultProfile": "{61c54bbd-1111-5271-96e7-009a87ff44bf}",
|
||||
"disabledProfileSources": [ "Windows.Terminal.Wsl" ],
|
||||
|
||||
"profiles": {
|
||||
"defaults": {
|
||||
|
|
|
@ -1078,9 +1078,13 @@ void CascadiaSettings::WriteSettingsToDisk() const
|
|||
Json::Value CascadiaSettings::ToJson() const
|
||||
{
|
||||
// top-level json object
|
||||
// directly inject "globals" and "$schema" into here
|
||||
// directly inject "globals", "$schema", and "disabledProfileSources" into here
|
||||
Json::Value json{ _globals->ToJson() };
|
||||
JsonUtils::SetValueForKey(json, SchemaKey, JsonKey(SchemaValue));
|
||||
if (_userSettings.isMember(JsonKey(DisabledProfileSourcesKey)))
|
||||
{
|
||||
json[JsonKey(DisabledProfileSourcesKey)] = _userSettings[JsonKey(DisabledProfileSourcesKey)];
|
||||
}
|
||||
|
||||
// "profiles" will always be serialized as an object
|
||||
Json::Value profiles{ Json::ValueType::objectValue };
|
||||
|
|
Loading…
Reference in a new issue