Skip to content

Commit

Permalink
Fix policy value (#171499)
Browse files Browse the repository at this point in the history
fixes #163418
  • Loading branch information
joaomoreno authored Jan 17, 2023
1 parent 19bd91a commit e393004
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 20 deletions.
13 changes: 0 additions & 13 deletions src/vs/platform/configuration/common/configuration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -297,19 +297,6 @@ export function merge(base: any, add: any, overwrite: boolean): void {
});
}

export function getMigratedSettingValue<T>(configurationService: IConfigurationService, currentSettingName: string, legacySettingName: string): T {
const setting = configurationService.inspect<T>(currentSettingName);
const legacySetting = configurationService.inspect<T>(legacySettingName);

if (typeof setting.userValue !== 'undefined' || typeof setting.workspaceValue !== 'undefined' || typeof setting.workspaceFolderValue !== 'undefined') {
return setting.value!;
} else if (typeof legacySetting.userValue !== 'undefined' || typeof legacySetting.workspaceValue !== 'undefined' || typeof legacySetting.workspaceFolderValue !== 'undefined') {
return legacySetting.value!;
} else {
return setting.defaultValue!;
}
}

export function getLanguageTagSettingPlainKey(settingKey: string) {
return settingKey.replace(/[\[\]]/g, '');
}
10 changes: 3 additions & 7 deletions src/vs/platform/update/electron-main/abstractUpdateService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import { timeout } from 'vs/base/common/async';
import { CancellationToken } from 'vs/base/common/cancellation';
import { Emitter, Event } from 'vs/base/common/event';
import { getMigratedSettingValue, IConfigurationService } from 'vs/platform/configuration/common/configuration';
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
import { IEnvironmentMainService } from 'vs/platform/environment/electron-main/environmentMainService';
import { ILifecycleMainService } from 'vs/platform/lifecycle/electron-main/lifecycleMainService';
import { ILogService } from 'vs/platform/log/common/log';
Expand Down Expand Up @@ -74,7 +74,7 @@ export abstract class AbstractUpdateService implements IUpdateService {
return;
}

const updateMode = this.getUpdateMode();
const updateMode = this.configurationService.getValue<'none' | 'manual' | 'start' | 'default'>('update.mode');
const quality = this.getProductQuality(updateMode);

if (!quality) {
Expand Down Expand Up @@ -106,10 +106,6 @@ export abstract class AbstractUpdateService implements IUpdateService {
}
}

protected getUpdateMode(): 'none' | 'manual' | 'start' | 'default' {
return getMigratedSettingValue<'none' | 'manual' | 'start' | 'default'>(this.configurationService, 'update.mode', 'update.channel');
}

private getProductQuality(updateMode: string): string | undefined {
return updateMode === 'none' ? undefined : this.productService.quality;
}
Expand Down Expand Up @@ -188,7 +184,7 @@ export abstract class AbstractUpdateService implements IUpdateService {
return undefined;
}

const mode = await this.getUpdateMode();
const mode = this.configurationService.getValue<'none' | 'manual' | 'start' | 'default'>('update.mode');

if (mode === 'none') {
return false;
Expand Down

0 comments on commit e393004

Please sign in to comment.