obsidian-tasks icon indicating copy to clipboard operation
obsidian-tasks copied to clipboard

feat: New "On Completion" field with support for Delete automatic action

Open therden opened this issue 9 months ago • 19 comments

The "On Completion" feature adds the ability for the Tasks plugin to perform certain actions on tasks automatically at the time they are completed.

Description

The feature adds a new, optional field to the Tasks task object: onCompletion, represented by the checkered flag emoji 🏁, followed by a string denoting the desired action.)

This first release supports only a single action ('delete'). Additional actions (to move the completed task either to a "completed tasks" list within its host note or to a dedicated "completed tasks" note file) are planned.

[Note: the Create or Edit Task.md file also will need to be updated once the onCompletion field is added to the Create/Edit Task modal.]

Motivation and Context

Several users have submitted Issues relating to actions that they want the Tasks plugin to take automatically as soon as they complete a given task.

One such action is to make completed instances of certain tasks disappear (especially common in connection with frequently-recurring tasks.) For reference, see the following issues and discussions:

  • https://github.com/obsidian-tasks-group/obsidian-tasks/issues/1647
  • https://github.com/obsidian-tasks-group/obsidian-tasks/discussions/2318
  • https://github.com/obsidian-tasks-group/obsidian-tasks/discussions/2478
  • https://github.com/obsidian-tasks-group/obsidian-tasks/issues/2547

How has this been tested?

Automated tests have been added

  • in connection with the new Tasks field;
  • in connection with the new OnCompletion feature generally; and
  • in connection with the "delete" action specifically

Screenshots (if appropriate)

Screenshot(s) pending update to the Create/Edit Task modal dialog.)

Types of changes

Changes visible to users:

  • [ ] Bug fix (prefix: fix - non-breaking change which fixes an issue)
  • [x] New feature (prefix: feat - non-breaking change which adds functionality)
  • [ ] Breaking change (prefix: feat!! or fix!! - fix or feature that would cause existing functionality to not work as expected)
  • [x] Documentation (prefix: docs - improvements to any documentation content for users)
  • [ ] Sample vault (prefix: vault - improvements to the Tasks-Demo sample vault)
  • [ ] Contributing Guidelines (prefix: contrib - any improvements to documentation content for contributors - see Contributing to Tasks)

Internal changes:

  • [ ] Refactor (prefix: refactor - non-breaking change which only improves the design or structure of existing code, and making no changes to its external behaviour)
  • [x] Tests (prefix: test - additions and improvements to unit tests and the smoke tests)
  • [ ] Infrastructure (prefix: chore - examples include GitHub Actions, issue templates)

Checklist

  • [x] My code follows the code style of this project and passes yarn run lint.
  • [x] My change requires a change to the documentation.
  • [x] I have updated the documentation accordingly.
  • [x] My change has adequate Unit Test coverage.

Terms

therden avatar May 20 '24 18:05 therden