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

Add 'Set Status' commands

Open claremacrae opened this issue 2 years ago • 2 comments

⚠️ Please check that this feature request hasn't been suggested before.

  • [X] I searched previous Ideas in Discussions didn't find any similar feature requests.
  • [X] I searched previous Issues didn't find any similar feature requests.

🔖 Feature description

The fork obsidian-tasks-x/src/Commands provides ToggleStatus commands, that allow users to run a command to set a task to a specific status, such as 'In Progress'.

A little work is needed before this is incorporated in to the obsidian-tasks code base:

  • ToggleStatus.ts is almost entirely a copy of the pre-existing ToggleDone.ts
  • But the ToggleDone.ts does not have some of the fixes made to the latest ToggleDone.ts in Tasks (like fixing issues with cursor position)

✔️ Solution

Consistency of code

  • Review the differences between:
    • ToggleDone in Tasks
    • ToggleDone in Tasks-x
  • Review the difference be
    • ToggleDone in Tasks-x
    • ToggleStatus in Tasks-x

At the end, there should be in Tasks the same sets of commands as in Tasks-x, but with the latest bug-fixes from Tasks, and without the copy-and-paste from Tasks-x.

Correctness of behaviour

Tasks-x then uses ToggleStatus to create the commands:

https://github.com/sytone/obsidian-tasks-x/blob/2c0b659457cc80806ff18585c955496c76861b87/src/Commands/index.ts#L31-L43

Note that it calls getSettings() to obtain the available statuses, and as explained in #1484 the settings do not store objects for TODO, IN_PROGRESS, DONE and CANCELLED - and so commands are not created for this.

It should instead get the available statuses from the StatusRegistry's global instance.

❓ Alternatives

No response

📝 Additional Context

No response

claremacrae avatar Jan 07 '23 22:01 claremacrae

Until this feature is implemented, the UI features to allow the user to enable commands should be hidden. This is the subject of https://github.com/obsidian-tasks-group/obsidian-tasks/issues/1487.

Part of fixing this issue is reverting the PR that implemented https://github.com/obsidian-tasks-group/obsidian-tasks/issues/1487.

claremacrae avatar Jan 08 '23 09:01 claremacrae

I've renamed this to remove reference to tasks-x, as Tasks has its own more robust mechanism for this now, which is how the 'Change task status' context menu facility works:

https://publish.obsidian.md/tasks/Editing/Toggling+and+Editing+Statuses#'Change+task+status'+context+menu

claremacrae avatar Jan 07 '24 12:01 claremacrae