Skip to content

Commit

Permalink
Remove notification
Browse files Browse the repository at this point in the history
  • Loading branch information
Jackson Kearl committed Apr 22, 2021
1 parent 4a8e949 commit 49924bb
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
4 changes: 1 addition & 3 deletions src/vs/workbench/contrib/url/browser/trustedDomains.ts
Original file line number Diff line number Diff line change
Expand Up @@ -116,12 +116,10 @@ export async function configureOpenerTrustedDomainsHandler(
switch (pickedResult.id) {
case 'manage':
await editorService.openEditor({
resource: TRUSTED_DOMAINS_URI,
resource: TRUSTED_DOMAINS_URI.with({ fragment: resource.toString() }),
mode: 'jsonc',
options: { pinned: true }
});
notificationService.prompt(Severity.Info, localize('configuringURL', "Configuring trust for: {0}", resource.toString()),
[{ label: 'Copy', run: () => clipboardService.writeText(resource.toString()) }]);
return trustedDomains;
case 'trust':
const itemToTrust = pickedResult.toTrust;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ const CONFIG_PLACEHOLDER_TEXT = `[
// "https://microsoft.com"
]`;

function computeTrustedDomainContent(defaultTrustedDomains: string[], trustedDomains: string[], userTrustedDomains: string[], workspaceTrustedDomains: string[]) {
function computeTrustedDomainContent(defaultTrustedDomains: string[], trustedDomains: string[], userTrustedDomains: string[], workspaceTrustedDomains: string[], configuring?: string) {
let content = CONFIG_HELP_TEXT_PRE;

if (defaultTrustedDomains.length > 0) {
Expand Down Expand Up @@ -77,6 +77,8 @@ function computeTrustedDomainContent(defaultTrustedDomains: string[], trustedDom

content += CONFIG_HELP_TEXT_AFTER;

content += configuring ? `\n// Currently configuring trust for ${configuring}\n` : '';

if (trustedDomains.length === 0) {
content += CONFIG_PLACEHOLDER_TEXT;
} else {
Expand Down Expand Up @@ -110,14 +112,17 @@ export class TrustedDomainsFileSystemProvider implements IFileSystemProviderWith
StorageScope.GLOBAL
);

const configuring: string | undefined = resource.fragment;

const { defaultTrustedDomains, trustedDomains, userDomains, workspaceDomains } = await this.instantiationService.invokeFunction(readTrustedDomains);
if (
!trustedDomainsContent ||
trustedDomainsContent.indexOf(CONFIG_HELP_TEXT_PRE) === -1 ||
trustedDomainsContent.indexOf(CONFIG_HELP_TEXT_AFTER) === -1 ||
trustedDomainsContent.indexOf(configuring ?? '') === -1 ||
[...defaultTrustedDomains, ...trustedDomains, ...userDomains, ...workspaceDomains].some(d => !assertIsDefined(trustedDomainsContent).includes(d))
) {
trustedDomainsContent = computeTrustedDomainContent(defaultTrustedDomains, trustedDomains, userDomains, workspaceDomains);
trustedDomainsContent = computeTrustedDomainContent(defaultTrustedDomains, trustedDomains, userDomains, workspaceDomains, configuring);
}

const buffer = VSBuffer.fromString(trustedDomainsContent).buffer;
Expand Down

0 comments on commit 49924bb

Please sign in to comment.