Skip to content

Commit

Permalink
fix: Ignore lookupConfirm if dailyVault is set (#1311)
Browse files Browse the repository at this point in the history
  • Loading branch information
Harshita-mindfire committed Sep 8, 2021
1 parent 956aa2a commit 1c734da
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 2 deletions.
6 changes: 5 additions & 1 deletion packages/plugin-core/src/commands/CreateDailyJournal.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { NoteUtils, VaultUtils } from "@dendronhq/common-all";
import { cleanName } from "@dendronhq/common-server";
import _ from "lodash";
import * as vscode from "vscode";
import { PickerUtilsV2 } from "../components/lookup/utils";
import { DENDRON_COMMANDS } from "../constants";
Expand Down Expand Up @@ -49,7 +50,10 @@ export class CreateDailyJournalCommand extends BaseCommand<
});
const { config, engine } = getDWorkspace();
let vault;
if (config.lookupConfirmVaultOnCreate) {
if (
_.isUndefined(config.journal.dailyVault) &&
config.lookupConfirmVaultOnCreate
) {
vault = await PickerUtilsV2.promptVault(engine.vaults);
if (vault === undefined) {
vscode.window.showInformationMessage(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ suite("Create Daily Journal Suite", function () {
});
});

test("default journal vault with lookup Confirm", (done) => {
test("default journal vault set with lookup Confirm", (done) => {
runLegacyMultiWorkspaceTest({
ctx,
onInit: async ({ wsRoot, vaults }) => {
Expand All @@ -75,6 +75,28 @@ suite("Create Daily Journal Suite", function () {
},
{ wsRoot }
);
await new CreateDailyJournalCommand().run();
expect(
(await EditorUtils.getURIForActiveEditor()).fsPath.includes(
vaults[0].fsPath
)
).toBeTruthy();
done();
},
});
});

test("default journal vault not set with lookup Confirm", (done) => {
runLegacyMultiWorkspaceTest({
ctx,
onInit: async ({ wsRoot, vaults }) => {
withConfig(
(config) => {
config.lookupConfirmVaultOnCreate = true;
return config;
},
{ wsRoot }
);
stubVaultPick(vaults);
await new CreateDailyJournalCommand().run();
expect(
Expand Down

0 comments on commit 1c734da

Please sign in to comment.