Browse Source

Adds prompt if patches setting is disabled on show

main
Eric Amodio 1 year ago
parent
commit
08f673ec22
1 changed files with 17 additions and 1 deletions
  1. +17
    -1
      src/plus/drafts/actions.ts

+ 17
- 1
src/plus/drafts/actions.ts View File

@ -1,10 +1,26 @@
import type { MessageItem } from 'vscode';
import { window } from 'vscode';
import { Container } from '../../container';
import { configuration } from '../../system/configuration';
import type { WebviewViewShowOptions } from '../../webviews/webviewsController';
import type { ShowCreateDraft, ShowViewDraft } from '../webviews/patchDetails/registration';
type ShowCreateOrOpen = ShowCreateDraft | ShowViewDraft;
export function showPatchesView(createOrOpen: ShowCreateOrOpen, options?: WebviewViewShowOptions): Promise<void> {
export async function showPatchesView(createOrOpen: ShowCreateOrOpen, options?: WebviewViewShowOptions): Promise<void> {
const confirm: MessageItem = { title: 'Enable' };
const cancel: MessageItem = { title: 'Cancel', isCloseAffordance: true };
const result = await window.showInformationMessage(
'Cloud Patches are currently disabled. Would you like to enable them?',
{ modal: true },
confirm,
cancel,
);
if (result !== confirm) return;
await configuration.updateEffective('cloudPatches.enabled', true);
if (createOrOpen.mode === 'create') {
options = { ...options, preserveFocus: false, preserveVisibility: false };
}

Loading…
Cancel
Save