Skip to content

Commit

Permalink
fix: notify in the right place
Browse files Browse the repository at this point in the history
  • Loading branch information
chhoumann committed Aug 24, 2022
1 parent 165b848 commit dded025
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions src/ui/PodcastView/spawnEpisodeContextMenu.ts
Expand Up @@ -71,13 +71,6 @@ export default function spawnEpisodeContextMenu(

if (!disabledMenuItems?.createNote) {
const episodeNoteExists = Boolean(getPodcastNote(episode));
const { path, template } = get(plugin).settings.note;
const canCreateNote = Boolean(path && template);

if (!canCreateNote) {
new Notice(`Please set a note path and template in the settings.`);
return;
}

menu.addItem(item => item
.setIcon("pencil")
Expand All @@ -86,6 +79,14 @@ export default function spawnEpisodeContextMenu(
if (episodeNoteExists) {
openPodcastNote(episode);
} else {
const { path, template } = get(plugin).settings.note;
const canCreateNote = Boolean(path && template);

if (!canCreateNote) {
new Notice(`Please set a note path and template in the settings.`);
return;
}

await createPodcastNote(episode);
}
}));
Expand Down

0 comments on commit dded025

Please sign in to comment.