Skip to content

Commit

Permalink
fix: 🐛 don't include templates folder and subfolders in destination list
Browse files Browse the repository at this point in the history
  • Loading branch information
ksalzke committed Mar 6, 2022
1 parent 6ff49a7 commit da2d58b
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions Templates.omnifocusjs/Resources/templateLibrary.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@

templateLibrary.getDestination = async (template) => {
const preferences = new Preferences('com.KaitlinSalzke.Templates')
const templateFolder = await templateLibrary.getTemplateFolder()

// find folder from string, if there is a destination
const match = template.note.match(/\$FOLDER=(.*?)$/m)
Expand All @@ -50,8 +51,8 @@
let projectsBoxChecked = false
destinationForm.addField(new Form.Field.Checkbox('projectsIncluded', 'Include projects', projectsBoxChecked))
// destination dropdown
const activeSections = flattenedSections.filter(section => section.effectiveActive === true || section instanceof Project && section.task.effectiveActive === true)
const activeFolders = flattenedFolders.filter(folder => folder.effectiveActive === true)
const activeSections = flattenedSections.filter(section => (section.effectiveActive === true || (section instanceof Project && section.task.effectiveActive === true)) && section !== templateFolder && !templateFolder.flattenedSections.includes(section))
const activeFolders = flattenedFolders.filter(folder => folder.effectiveActive === true && folder !== templateFolder && !templateFolder.flattenedFolders.includes(folder))

function updateDestinationDropdown (sections) {
const sortedSections = preferences.readBoolean('sortLocationsAlphabetically') ? sections.sort((a, b) => a.name > b.name) : sections
Expand Down

0 comments on commit da2d58b

Please sign in to comment.