global profile settings - fixes #4098

This commit is contained in:
Eugene Pankov
2021-08-22 00:10:56 +02:00
parent 0a3debb691
commit 20116d7af6
6 changed files with 162 additions and 108 deletions

View File

@@ -21,6 +21,8 @@ hotkeys:
profile:
__nonStructural: true
profiles: []
profileDefaults:
__nonStructural: true
recentProfiles: []
recoverTabs: true
enableAnalytics: true

View File

@@ -179,9 +179,13 @@ export class ProfilesService {
return null
}
getConfigProxyForProfile <T extends Profile> (profile: PartialProfile<T>): T {
getConfigProxyForProfile <T extends Profile> (profile: PartialProfile<T>, skipUserDefaults = false): T {
const provider = this.providerForProfile(profile)
const defaults = configMerge(this.profileDefaults, provider?.configDefaults ?? {})
const defaults = [
this.profileDefaults,
provider?.configDefaults ?? {},
!provider || skipUserDefaults ? {} : this.config.store.profileDefaults[provider.id] ?? {},
].reduce(configMerge, {})
return new ConfigProxy(profile, defaults) as unknown as T
}
}