mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-07-07 20:06:36 +02:00
change order of hook invocation and setting task id (#3339)
this prevents that the task id is always returned as zero after a hook is run on it closes #3312
This commit is contained in:
parent
933885f21c
commit
b5aa7c6ae2
1 changed files with 6 additions and 5 deletions
11
src/TDB2.cpp
11
src/TDB2.cpp
|
@ -87,7 +87,7 @@ void TDB2::add (Task& task)
|
||||||
for (auto& attr : task.all ()) {
|
for (auto& attr : task.all ()) {
|
||||||
// TaskChampion does not store uuid or id in the taskmap
|
// TaskChampion does not store uuid or id in the taskmap
|
||||||
if (attr == "uuid" || attr == "id") {
|
if (attr == "uuid" || attr == "id") {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Use `set_status` for the task status, to get expected behavior
|
// Use `set_status` for the task status, to get expected behavior
|
||||||
|
@ -118,12 +118,13 @@ void TDB2::add (Task& task)
|
||||||
// update the cached working set with the new information
|
// update the cached working set with the new information
|
||||||
_working_set = std::make_optional (std::move (ws));
|
_working_set = std::make_optional (std::move (ws));
|
||||||
|
|
||||||
if (id.has_value ()) {
|
|
||||||
task.id = id.value();
|
|
||||||
}
|
|
||||||
|
|
||||||
// run hooks for this new task
|
// run hooks for this new task
|
||||||
Context::getContext ().hooks.onAdd (task);
|
Context::getContext ().hooks.onAdd (task);
|
||||||
|
|
||||||
|
if (id.has_value ()) {
|
||||||
|
task.id = id.value();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue