Merge pull request #2498 from kydorn/feat/linux-window-controls-style
feat(desktop): gate traffic-lights behind window-controls style setting
This commit is contained in:
@@ -197,6 +197,12 @@ export const createSettingsHelpers = (dependencies) => {
|
||||
result.desktopWindowControlsPosition = 'left';
|
||||
}
|
||||
}
|
||||
if (typeof candidate.desktopWindowControlsStyle === 'string') {
|
||||
const style = candidate.desktopWindowControlsStyle.trim();
|
||||
if (style === 'classic' || style === 'traffic-lights') {
|
||||
result.desktopWindowControlsStyle = style;
|
||||
}
|
||||
}
|
||||
if (candidate.permissionAutoAccept && typeof candidate.permissionAutoAccept === 'object' && !Array.isArray(candidate.permissionAutoAccept)) {
|
||||
const sessions = {};
|
||||
const sourceSessions = candidate.permissionAutoAccept.sessions;
|
||||
|
||||
@@ -169,6 +169,19 @@ describe('settings helpers', () => {
|
||||
expect(helpers.sanitizeSettingsUpdate({ desktopWindowControlsPosition: 'center' })).toEqual({});
|
||||
});
|
||||
|
||||
it('sanitizes desktopWindowControlsStyle and rejects unknown values', () => {
|
||||
const helpers = createTestHelpers();
|
||||
|
||||
expect(helpers.sanitizeSettingsUpdate({ desktopWindowControlsStyle: 'classic' })).toEqual({
|
||||
desktopWindowControlsStyle: 'classic',
|
||||
});
|
||||
expect(helpers.sanitizeSettingsUpdate({ desktopWindowControlsStyle: 'traffic-lights' })).toEqual({
|
||||
desktopWindowControlsStyle: 'traffic-lights',
|
||||
});
|
||||
expect(helpers.sanitizeSettingsUpdate({ desktopWindowControlsStyle: 'macos' })).toEqual({});
|
||||
expect(helpers.sanitizeSettingsUpdate({ desktopWindowControlsStyle: 'auto' })).toEqual({});
|
||||
});
|
||||
|
||||
it('sanitizes the persisted permission auto-accept policy', () => {
|
||||
const helpers = createTestHelpers();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user