From 7732fb205247fddf3ee56bb852d7bd14e3cd5c27 Mon Sep 17 00:00:00 2001 From: Hayata Suenaga <98560306+hayata-suenaga@users.noreply.github.com> Date: Mon, 11 Jul 2022 10:54:52 -0700 Subject: [PATCH 1/6] chore: add new config opt --- packages/common-all/src/types/configs/publishing/publishing.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/packages/common-all/src/types/configs/publishing/publishing.ts b/packages/common-all/src/types/configs/publishing/publishing.ts index 436b23dfd0..684f87dc51 100644 --- a/packages/common-all/src/types/configs/publishing/publishing.ts +++ b/packages/common-all/src/types/configs/publishing/publishing.ts @@ -49,6 +49,7 @@ export type DendronPublishingConfig = { cognitoClientId?: string; enablePrettyLinks: boolean; siteBanner?: string; + privateNoteBehavior: "privateLink" | "titleFallback"; }; export type CleanDendronPublishingConfig = DendronPublishingConfig & @@ -108,5 +109,6 @@ export function genDefaultPublishingConfig(): DendronPublishingConfig { enableRandomlyColoredTags: true, enableTaskNotes: true, enablePrettyLinks: true, + privateNoteBehavior: "privateLink", }; } From 84698c6baf2b2bba066b6d4f38632967a5698109 Mon Sep 17 00:00:00 2001 From: Hayata Suenaga <98560306+hayata-suenaga@users.noreply.github.com> Date: Mon, 11 Jul 2022 10:58:59 -0700 Subject: [PATCH 2/6] chore: update validator json --- packages/common-all/data/dendron-yml.validator.json | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/packages/common-all/data/dendron-yml.validator.json b/packages/common-all/data/dendron-yml.validator.json index e2ed999941..aafde94a0b 100644 --- a/packages/common-all/data/dendron-yml.validator.json +++ b/packages/common-all/data/dendron-yml.validator.json @@ -1174,6 +1174,13 @@ }, "siteBanner": { "type": "string" + }, + "privateNoteBehavior": { + "type": "string", + "enum": [ + "privateLink", + "titleFallback" + ] } }, "required": [ @@ -1186,7 +1193,8 @@ "writeStubs", "seo", "github", - "enablePrettyLinks" + "enablePrettyLinks", + "privateNoteBehavior" ], "additionalProperties": false, "description": "Namespace for all publishing related configurations" From 60eb079a6023a38f7d55704da0dbc075018bc60d Mon Sep 17 00:00:00 2001 From: Hayata Suenaga <98560306+hayata-suenaga@users.noreply.github.com> Date: Tue, 12 Jul 2022 13:24:11 -0700 Subject: [PATCH 3/6] chore: implement & write tests for private note behavior --- .../src/markdown/remark/dendronPub.ts | 48 ++++-- .../engine-server/markdown/dendronPub.spec.ts | 161 +++++++++++++----- .../engine-test-utils/src/utils/unified.ts | 10 ++ 3 files changed, 161 insertions(+), 58 deletions(-) diff --git a/packages/engine-server/src/markdown/remark/dendronPub.ts b/packages/engine-server/src/markdown/remark/dendronPub.ts index 023afb3f96..1db88f489c 100644 --- a/packages/engine-server/src/markdown/remark/dendronPub.ts +++ b/packages/engine-server/src/markdown/remark/dendronPub.ts @@ -1,6 +1,7 @@ import { ConfigUtils, DendronError, + DendronPublishingConfig, DEngineClient, DVault, ERROR_SEVERITY, @@ -394,23 +395,40 @@ function plugin(this: Unified.Processor, opts?: PluginOpts): Transformer { ], } as RehypeLinkData; + const privateBehavior = ( + ConfigUtils.getPublishingConfig(config) as DendronPublishingConfig + ).privateNoteBehavior; + if (value === "403") { - _node.data = { - alias, - hName: "a", - hProperties: { - title: "Private", - href: "https://wiki.dendron.so/notes/hfyvYGJZQiUwQaaxQO27q.html", - target: "_blank", - class: "private", - }, - hChildren: [ - { - type: "text", - value: `${alias} (Private)`, + if (privateBehavior === "titleFallback" && data.alias) { + _node.data = { + alias, + type: "paragraph", + children: [ + { + type: "text", + value: alias, + }, + ], + }; + } else { + _node.data = { + alias, + hName: "a", + hProperties: { + title: "Private", + href: "https://wiki.dendron.so/notes/hfyvYGJZQiUwQaaxQO27q.html", + target: "_blank", + class: "private", }, - ], - } as RehypeLinkData; + hChildren: [ + { + type: "text", + value: `${alias} (Private)`, + }, + ], + } as RehypeLinkData; + } } } if (node.type === DendronASTTypes.REF_LINK_V2) { diff --git a/packages/engine-test-utils/src/__tests__/engine-server/markdown/dendronPub.spec.ts b/packages/engine-test-utils/src/__tests__/engine-server/markdown/dendronPub.spec.ts index abc7932dbc..c094c59f74 100644 --- a/packages/engine-test-utils/src/__tests__/engine-server/markdown/dendronPub.spec.ts +++ b/packages/engine-test-utils/src/__tests__/engine-server/markdown/dendronPub.spec.ts @@ -3,6 +3,7 @@ import { DEngineClient, DVault, IntermediateDendronConfig, + StrictConfigV5, VaultUtils, WorkspaceOpts, } from "@dendronhq/common-all"; @@ -59,6 +60,13 @@ const verifyPrivateLink = async ( }); }; +const verifyAlias = async (vfile: VFile, value: string, capitalize = true) => { + return TestUnifiedUtils.verifyAlias({ + contents: vfile.contents as string, + value: capitalize ? _.capitalize(value) : value, + }); +}; + function verifyPublicLink(resp: any, match: string) { return checkString(resp.contents as string, ``); } @@ -202,20 +210,75 @@ describe("GIVEN dendronPub", () => { }); describe("WHEN publish and private hierarchies", () => { - const fname = fnameBeta; - const config = genPublishConfigWithPublicPrivateHierarchies(); + let config: StrictConfigV5; + + beforeEach(() => { + config = genPublishConfigWithPublicPrivateHierarchies(); + }); + + describe("AND WHEN noteref of published note", () => { + let resp: VFile; - describe("AND WHEN noteRef", () => { - describe("AND WHEN noteref of published note", () => { - let resp: VFile; + beforeAll(async () => { + await runEngineTestV5( + async (opts) => { + resp = await createProc({ + ...opts, + config, + fname: fnameBeta, + linkText: `![[beta]]`, + }); + }, + { + preSetupHook: ENGINE_HOOKS.setupLinks, + expect, + } + ); + }); + + test("THEN published note is rendered", async () => { + await verifyPublicNoteRef(resp, fnameBeta); + }); + test("THEN private link in published note is hidden", async () => { + await verifyPrivateLink(resp, fnameAlpha); + }); + }); + + describe("AND WHEN noteref of private note", () => { + let resp: VFile; + beforeAll(async () => { + await runEngineTestV5( + async (opts) => { + resp = await createProc({ + ...opts, + config, + fname: fnameBeta, + linkText: `![[alpha]]`, + }); + }, + { + preSetupHook: ENGINE_HOOKS.setupLinks, + expect, + } + ); + }); + test("THEN private note is not rendered", async () => { + await verifyPrivateNoteRef(resp); + }); + }); + + describe("AND WHEN wikilink", () => { + let resp: VFile; + + test("THEN public link is rendered", async () => { beforeAll(async () => { await runEngineTestV5( async (opts) => { resp = await createProc({ ...opts, config, - fname, - linkText: `![[beta]]`, + fname: fnameBeta, + linkText: `[[beta]] [[alpha]]`, }); }, { @@ -224,24 +287,18 @@ describe("GIVEN dendronPub", () => { } ); }); - test("THEN published note is rendered", async () => { - await verifyPublicNoteRef(resp, fnameBeta); - }); - test("THEN private link in published note is hidden", async () => { - await verifyPrivateLink(resp, fnameAlpha); - }); + await verifyPublicLink(resp, fnameBeta); }); - describe("AND WHEN noteref of private note", () => { - let resp: VFile; + describe("AND WHNEN wikilink has an alias", () => { beforeAll(async () => { await runEngineTestV5( async (opts) => { resp = await createProc({ ...opts, config, - fname, - linkText: `![[alpha]]`, + fname: fnameBeta, + linkText: `[[Alpha|alpha]]`, }); }, { @@ -250,35 +307,53 @@ describe("GIVEN dendronPub", () => { } ); }); - test("THEN private note is not rendered", async () => { - await verifyPrivateNoteRef(resp); + describe("AND WHEN privateNoteBehavior config is aliasFallback", () => { + beforeAll(() => { + ConfigUtils.setPublishProp( + config, + "privateNoteBehavior", + "titleFallback" + ); + }); + test("THEN a wikilink should be converted to a paragraph with the note alias as its text", async () => { + await verifyAlias(resp!, "Alpha"); + }); }); - }); - }); - describe("AND WHEN wikilink", () => { - let resp: VFile; - beforeAll(async () => { - await runEngineTestV5( - async (opts) => { - resp = await createProc({ - ...opts, + describe("AND WHEN privateNoteBehavior config is privateLink", () => { + beforeAll(() => { + ConfigUtils.setPublishProp( config, - fname, - linkText: `[[beta]] [[alpha]]`, - }); - }, - { - preSetupHook: ENGINE_HOOKS.setupLinks, - expect, - } - ); - }); - test("THEN public link is rendered", async () => { - await verifyPublicLink(resp, fnameBeta); + "privateNoteBehavior", + "privateLink" + ); + }); + test("THEN private link in published note is hidden", async () => { + await verifyPrivateLink(resp!, "Alpha"); + }); + }); }); - test("THEN private link is hidden", async () => { - await verifyPrivateLink(resp, fnameAlpha); + + describe("AND WHNEN wikilink has no alias", () => { + beforeAll(async () => { + await runEngineTestV5( + async (opts) => { + resp = await createProc({ + ...opts, + config, + fname: fnameBeta, + linkText: `[[alpha]]`, + }); + }, + { + preSetupHook: ENGINE_HOOKS.setupLinks, + expect, + } + ); + }); + test("THEN private link in published note is hidden", async () => { + await verifyPrivateLink(resp!, "Alpha"); + }); }); }); @@ -291,7 +366,7 @@ describe("GIVEN dendronPub", () => { resp = await createProc({ ...opts, config, - fname, + fname: fnameBeta, linkText: `[[dendron://${vaultName}/beta]] [[dendron://${vaultName}/alpha]]`, }); }, diff --git a/packages/engine-test-utils/src/utils/unified.ts b/packages/engine-test-utils/src/utils/unified.ts index 608c1f2db5..82361a2ccc 100644 --- a/packages/engine-test-utils/src/utils/unified.ts +++ b/packages/engine-test-utils/src/utils/unified.ts @@ -26,6 +26,16 @@ export class TestUnifiedUtils { return checkString(contents, 'class="private"', value + " (Private)"); }; + static verifyAlias = ({ + contents, + value, + }: { + contents: string; + value: string; + }) => { + return checkString(contents, value); + }; + /** Gets the descendent (child, or child of child...) node of a given node. * * @param node The root node to start descending from. From 40a9eb8b725de4e807d7bd37ef64fc95096bd858 Mon Sep 17 00:00:00 2001 From: Hayata Suenaga <98560306+hayata-suenaga@users.noreply.github.com> Date: Wed, 13 Jul 2022 10:18:08 -0700 Subject: [PATCH 4/6] fix: test --- .../engine-server/markdown/dendronPub.spec.ts | 32 +++++++++---------- 1 file changed, 15 insertions(+), 17 deletions(-) diff --git a/packages/engine-test-utils/src/__tests__/engine-server/markdown/dendronPub.spec.ts b/packages/engine-test-utils/src/__tests__/engine-server/markdown/dendronPub.spec.ts index c094c59f74..f1187d9a55 100644 --- a/packages/engine-test-utils/src/__tests__/engine-server/markdown/dendronPub.spec.ts +++ b/packages/engine-test-utils/src/__tests__/engine-server/markdown/dendronPub.spec.ts @@ -271,26 +271,24 @@ describe("GIVEN dendronPub", () => { let resp: VFile; test("THEN public link is rendered", async () => { - beforeAll(async () => { - await runEngineTestV5( - async (opts) => { - resp = await createProc({ - ...opts, - config, - fname: fnameBeta, - linkText: `[[beta]] [[alpha]]`, - }); - }, - { - preSetupHook: ENGINE_HOOKS.setupLinks, - expect, - } - ); - }); + resp = await runEngineTestV5( + async (opts) => { + resp = await createProc({ + ...opts, + config, + fname: fnameBeta, + linkText: `[[beta]] [[alpha]]`, + }); + }, + { + preSetupHook: ENGINE_HOOKS.setupLinks, + expect, + } + ); await verifyPublicLink(resp, fnameBeta); }); - describe("AND WHNEN wikilink has an alias", () => { + describe("AND WHEN wikilink has an alias", () => { beforeAll(async () => { await runEngineTestV5( async (opts) => { From e2c58b98eb7e2f1ec0c7691fe1168af78f58d568 Mon Sep 17 00:00:00 2001 From: Hayata Suenaga <98560306+hayata-suenaga@users.noreply.github.com> Date: Wed, 13 Jul 2022 10:27:40 -0700 Subject: [PATCH 5/6] fix: config name --- .../data/dendron-yml.validator.json | 192 ++++-------------- .../types/configs/publishing/publishing.ts | 2 +- .../src/markdown/remark/dendronPub.ts | 2 +- .../engine-server/markdown/dendronPub.spec.ts | 2 +- 4 files changed, 41 insertions(+), 157 deletions(-) diff --git a/packages/common-all/data/dendron-yml.validator.json b/packages/common-all/data/dendron-yml.validator.json index aafde94a0b..86e297c3b9 100644 --- a/packages/common-all/data/dendron-yml.validator.json +++ b/packages/common-all/data/dendron-yml.validator.json @@ -8,10 +8,7 @@ "properties": { "version": { "type": "number", - "enum": [ - 4, - 5 - ] + "enum": [4, 5] }, "dev": { "$ref": "#/definitions/DendronDevConfig", @@ -58,9 +55,7 @@ "$ref": "#/definitions/DendronPublishingConfig" } }, - "required": [ - "version" - ] + "required": ["version"] }, "DendronDevConfig": { "type": "object", @@ -87,10 +82,7 @@ }, "forceWatcherType": { "type": "string", - "enum": [ - "plugin", - "engine" - ], + "enum": ["plugin", "engine"], "description": "Force the use of a specific type of watcher.\n\n- plugin: Uses VSCode's builtin watcher\n- engine: Uses the engine watcher, watching the files directly without VSCode" }, "enableExportPodV2": { @@ -182,10 +174,7 @@ }, "gh_edit_view_mode": { "type": "string", - "enum": [ - "tree", - "edit" - ] + "enum": ["tree", "edit"] }, "gh_edit_repository": { "type": "string" @@ -243,10 +232,7 @@ "type": "string" } }, - "required": [ - "url", - "alt" - ], + "required": ["url", "alt"], "additionalProperties": false, "description": "Default SEO image for published pages" }, @@ -282,10 +268,7 @@ "description": "Display a `#` symbol in front of frontmatter tags in the tags listing. False by default." } }, - "required": [ - "siteHierarchies", - "siteRootDir" - ], + "required": ["siteHierarchies", "siteRootDir"], "additionalProperties": false }, "LegacyHierarchyConfig": { @@ -324,10 +307,7 @@ }, "value": {} }, - "required": [ - "key", - "value" - ], + "required": ["key", "value"], "additionalProperties": false }, "LegacyDuplicateNoteBehavior": { @@ -343,10 +323,7 @@ "$ref": "#/definitions/LegacyUseVaultBehaviorPayload" } }, - "required": [ - "action", - "payload" - ], + "required": ["action", "payload"], "additionalProperties": false }, "LegacyDuplicateNoteAction": { @@ -362,9 +339,7 @@ "$ref": "#/definitions/DVault" } }, - "required": [ - "vault" - ], + "required": ["vault"], "additionalProperties": false }, { @@ -424,9 +399,7 @@ "description": "Index page for the vault" } }, - "required": [ - "fsPath" - ], + "required": ["fsPath"], "additionalProperties": false }, "DVaultVisibility": { @@ -444,10 +417,7 @@ "type": "string" } }, - "required": [ - "type", - "url" - ], + "required": ["type", "url"], "additionalProperties": false }, "DPermission": { @@ -466,20 +436,12 @@ } } }, - "required": [ - "read", - "write" - ], + "required": ["read", "write"], "additionalProperties": false }, "DVaultSync": { "type": "string", - "enum": [ - "skip", - "noPush", - "noCommit", - "sync" - ] + "enum": ["skip", "noPush", "noCommit", "sync"] }, "DendronCommandConfig": { "type": "object", @@ -521,9 +483,7 @@ "$ref": "#/definitions/NoteLookupConfig" } }, - "required": [ - "note" - ], + "required": ["note"], "additionalProperties": false, "description": "Namespace for configuring lookup commands" }, @@ -562,19 +522,12 @@ }, "LookupSelectionMode": { "type": "string", - "enum": [ - "extract", - "link", - "none" - ], + "enum": ["extract", "link", "none"], "description": "String literal type generated from {@link NoteLookupSelectionBehaviorEnum }" }, "LookupSelectVaultModeOnCreate": { "type": "string", - "enum": [ - "smart", - "alwaysPrompt" - ] + "enum": ["smart", "alwaysPrompt"] }, "RandomNoteConfig": { "type": "object", @@ -605,22 +558,13 @@ "type": "boolean" } }, - "required": [ - "aliasMode", - "enableMultiSelect" - ], + "required": ["aliasMode", "enableMultiSelect"], "additionalProperties": false, "description": "Namespace for configuring {@link InsertNoteLinkCommand }" }, "InsertNoteLinkAliasModeEnum": { "type": "string", - "enum": [ - "snippet", - "selection", - "title", - "prompt", - "none" - ], + "enum": ["snippet", "selection", "title", "prompt", "none"], "description": "Enum definitions of possible alias mode values" }, "InsertNoteIndexConfig": { @@ -630,9 +574,7 @@ "type": "boolean" } }, - "required": [ - "enableMarker" - ], + "required": ["enableMarker"], "additionalProperties": false, "description": "Namespace for configuring {@link InsertNoteIndexCommand }" }, @@ -654,11 +596,7 @@ }, "NonNoteFileLinkAnchorType": { "type": "string", - "enum": [ - "line", - "block", - "prompt" - ], + "enum": ["line", "block", "prompt"], "description": "\"line\" uses line numbers (`L23`), \"block\" inserts block anchors (`^xf1g...`). \"prompt\" means prompt the user to select one." }, "DendronWorkspaceConfig": { @@ -792,9 +730,7 @@ "$ref": "#/definitions/RemoteEndpoint" } }, - "required": [ - "remote" - ], + "required": ["remote"], "additionalProperties": false }, "DendronSeedEntry": { @@ -819,9 +755,7 @@ "type": "string" } }, - "required": [ - "url" - ], + "required": ["url"], "additionalProperties": false }, "DHookDict": { @@ -834,9 +768,7 @@ } } }, - "required": [ - "onCreate" - ], + "required": ["onCreate"], "additionalProperties": false }, "DHookEntry": { @@ -853,11 +785,7 @@ "const": "js" } }, - "required": [ - "id", - "pattern", - "type" - ], + "required": ["id", "pattern", "type"], "additionalProperties": false }, "JournalConfig": { @@ -879,12 +807,7 @@ "$ref": "#/definitions/NoteAddBehaviorEnum" } }, - "required": [ - "dailyDomain", - "name", - "dateFormat", - "addBehavior" - ], + "required": ["dailyDomain", "name", "dateFormat", "addBehavior"], "additionalProperties": false, "description": "Namespace for configuring journal note behavior" }, @@ -911,11 +834,7 @@ "$ref": "#/definitions/NoteAddBehaviorEnum" } }, - "required": [ - "name", - "dateFormat", - "addBehavior" - ], + "required": ["name", "dateFormat", "addBehavior"], "additionalProperties": false, "description": "Namespace for configuring scratch note behavior" }, @@ -976,11 +895,7 @@ }, "LegacyLookupSelectionType": { "type": "string", - "enum": [ - "selection2link", - "selectionExtract", - "none" - ] + "enum": ["selection2link", "selectionExtract", "none"] }, "DendronGraphConfig": { "type": "object", @@ -993,21 +908,13 @@ "description": "If true, create a note if it hasn't been created already when clicked on a graph node" } }, - "required": [ - "zoomSpeed", - "createStub" - ], + "required": ["zoomSpeed", "createStub"], "additionalProperties": false, "description": "Namespace for all graph related configurations." }, "VaultSyncMode": { "type": "string", - "enum": [ - "skip", - "noPush", - "noCommit", - "sync" - ] + "enum": ["skip", "noPush", "noCommit", "sync"] }, "DendronPreviewConfig": { "type": "object", @@ -1055,11 +962,7 @@ }, "Theme": { "type": "string", - "enum": [ - "dark", - "light", - "custom" - ] + "enum": ["dark", "light", "custom"] }, "DendronPublishingConfig": { "type": "object", @@ -1177,10 +1080,7 @@ }, "privateNoteBehavior": { "type": "string", - "enum": [ - "privateLink", - "titleFallback" - ] + "enum": ["privateLink", "aliasFallback"] } }, "required": [ @@ -1241,10 +1141,7 @@ }, "value": {} }, - "required": [ - "key", - "value" - ], + "required": ["key", "value"], "additionalProperties": false }, "DuplicateNoteBehavior": { @@ -1260,10 +1157,7 @@ "$ref": "#/definitions/DuplicateNoteActionPayload" } }, - "required": [ - "action", - "payload" - ], + "required": ["action", "payload"], "additionalProperties": false }, "DuplicateNoteAction": { @@ -1282,9 +1176,7 @@ "$ref": "#/definitions/DVault" } }, - "required": [ - "vault" - ], + "required": ["vault"], "additionalProperties": false }, { @@ -1327,10 +1219,7 @@ "type": "string" } }, - "required": [ - "url", - "alt" - ], + "required": ["url", "alt"], "additionalProperties": false }, "GithubConfig": { @@ -1355,18 +1244,13 @@ "type": "string" } }, - "required": [ - "enableEditLink" - ], + "required": ["enableEditLink"], "additionalProperties": false, "description": "Namespace for publishing related github configs" }, "GithubEditViewMode": { "type": "string", - "enum": [ - "tree", - "edit" - ] + "enum": ["tree", "edit"] } } -} \ No newline at end of file +} diff --git a/packages/common-all/src/types/configs/publishing/publishing.ts b/packages/common-all/src/types/configs/publishing/publishing.ts index 684f87dc51..d19cb0e735 100644 --- a/packages/common-all/src/types/configs/publishing/publishing.ts +++ b/packages/common-all/src/types/configs/publishing/publishing.ts @@ -49,7 +49,7 @@ export type DendronPublishingConfig = { cognitoClientId?: string; enablePrettyLinks: boolean; siteBanner?: string; - privateNoteBehavior: "privateLink" | "titleFallback"; + privateNoteBehavior: "privateLink" | "aliasFallback"; }; export type CleanDendronPublishingConfig = DendronPublishingConfig & diff --git a/packages/engine-server/src/markdown/remark/dendronPub.ts b/packages/engine-server/src/markdown/remark/dendronPub.ts index 1db88f489c..722984ce27 100644 --- a/packages/engine-server/src/markdown/remark/dendronPub.ts +++ b/packages/engine-server/src/markdown/remark/dendronPub.ts @@ -400,7 +400,7 @@ function plugin(this: Unified.Processor, opts?: PluginOpts): Transformer { ).privateNoteBehavior; if (value === "403") { - if (privateBehavior === "titleFallback" && data.alias) { + if (privateBehavior === "aliasFallback" && data.alias) { _node.data = { alias, type: "paragraph", diff --git a/packages/engine-test-utils/src/__tests__/engine-server/markdown/dendronPub.spec.ts b/packages/engine-test-utils/src/__tests__/engine-server/markdown/dendronPub.spec.ts index f1187d9a55..ab1189c74e 100644 --- a/packages/engine-test-utils/src/__tests__/engine-server/markdown/dendronPub.spec.ts +++ b/packages/engine-test-utils/src/__tests__/engine-server/markdown/dendronPub.spec.ts @@ -310,7 +310,7 @@ describe("GIVEN dendronPub", () => { ConfigUtils.setPublishProp( config, "privateNoteBehavior", - "titleFallback" + "aliasFallback" ); }); test("THEN a wikilink should be converted to a paragraph with the note alias as its text", async () => { From 72ff31d597497d06f87d5c7b400121790adca964 Mon Sep 17 00:00:00 2001 From: Hayata Suenaga <98560306+hayata-suenaga@users.noreply.github.com> Date: Wed, 13 Jul 2022 11:43:01 -0700 Subject: [PATCH 6/6] fix: ts issues --- packages/common-all/src/constants/configs/publishing.ts | 5 +++++ packages/plugin-core/src/test/utils/workspace.ts | 1 + packages/plugin-core/src/utils/pods.ts | 4 ++-- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/packages/common-all/src/constants/configs/publishing.ts b/packages/common-all/src/constants/configs/publishing.ts index 452d56f2d5..35ed6829ed 100644 --- a/packages/common-all/src/constants/configs/publishing.ts +++ b/packages/common-all/src/constants/configs/publishing.ts @@ -211,4 +211,9 @@ export const PUBLISHING: DendronConfigEntryCollection = label: "Add a custom banner to the site", desc: "EXPERIMENTAL: do not use", }, + privateNoteBehavior: { + label: + "Set how wikilinks and note references are converted when publishing", + desc: "When the note that a wikilink points to is private and when privateNoteBehavior is set to `aliasFallback`, it's replaced with a paragraph that contains an the link's alias", + }, }; diff --git a/packages/plugin-core/src/test/utils/workspace.ts b/packages/plugin-core/src/test/utils/workspace.ts index 9d2ab4f7a5..07939e369b 100644 --- a/packages/plugin-core/src/test/utils/workspace.ts +++ b/packages/plugin-core/src/test/utils/workspace.ts @@ -135,6 +135,7 @@ export class WorkspaceTestUtils { enableRandomlyColoredTags: true, enableTaskNotes: true, enablePrettyLinks: true, + privateNoteBehavior: "privateLink", }, }; if (duplicateNoteBehavior) { diff --git a/packages/plugin-core/src/utils/pods.ts b/packages/plugin-core/src/utils/pods.ts index 28722fc694..8867ad2feb 100644 --- a/packages/plugin-core/src/utils/pods.ts +++ b/packages/plugin-core/src/utils/pods.ts @@ -13,7 +13,6 @@ import * as queryString from "query-string"; import { ProgressLocation, QuickPickItem, Uri, window } from "vscode"; import { gdocRequiredScopes, GLOBAL_STATE } from "../constants"; import { StateService } from "../services/stateService"; -import { GOOGLE_OAUTH_ID } from "../types/global"; import { clipboard } from "../utils"; import { VSCodeUtils } from "../vsCodeUtils"; import { getDWorkspace } from "../workspace"; @@ -44,7 +43,8 @@ export const launchGoogleOAuthFlow = async (id?: string) => { ); const stringifiedParams = queryString.stringify({ - client_id: GOOGLE_OAUTH_ID, + client_id: + "158580191802-mg09ec0cnahjrct3a6dtk1a6rpiq5rpj.apps.googleusercontent.com", redirect_uri: `http://localhost:${port}/api/oauth/getToken?service=google&connectionId=${id}`, scope: gdocRequiredScopes.join(" "), // space seperated string response_type: "code",