mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-07-07 20:06:36 +02:00
Hooks
- Stubbed new ::onAdd and ::onModify interfaces.
This commit is contained in:
parent
7b617a7b6e
commit
ab72cdad4d
3 changed files with 15 additions and 10 deletions
12
src/TDB2.cpp
12
src/TDB2.cpp
|
@ -570,9 +570,7 @@ void TDB2::add (Task& task, bool add_to_backlog /* = true */)
|
|||
// Create a vector tasks, as hooks can cause them to multiply.
|
||||
std::vector <Task> changes;
|
||||
changes.push_back (task);
|
||||
|
||||
// TODO call hooks.
|
||||
// context.hooks.onAdd (changes);
|
||||
context.hooks.onAdd (changes);
|
||||
|
||||
update (uuid, task, add_to_backlog, changes);
|
||||
}
|
||||
|
@ -584,12 +582,14 @@ void TDB2::modify (Task& task, bool add_to_backlog /* = true */)
|
|||
task.validate (false);
|
||||
std::string uuid = task.get ("uuid");
|
||||
|
||||
// Get the unmodified task as reference, so the hook can compare.
|
||||
Task original;
|
||||
get (uuid, original);
|
||||
|
||||
// Create a vector tasks, as hooks can cause them to multiply.
|
||||
std::vector <Task> changes;
|
||||
changes.push_back (task);
|
||||
|
||||
// TODO call hooks.
|
||||
// context.hooks.onModify (changes);
|
||||
context.hooks.onModify (original, changes);
|
||||
|
||||
update (uuid, task, add_to_backlog, changes);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue