TW-1580: "modified" attribute not updated

- Make all local modifications update the "modified" attribute.
- As per design, the user cannot overwrite this attribute; neither
  can hooks.
This commit is contained in:
Wilhelm Schuermann 2015-03-23 15:55:47 +01:00
parent 052a5c607a
commit 4f75652ccb
2 changed files with 9 additions and 1 deletions

View file

@ -2,6 +2,7 @@
- TW-1578 Bash tab completion problems on first run - TW-1578 Bash tab completion problems on first run
(thanks to Renato Alves and Ptolemarch). (thanks to Renato Alves and Ptolemarch).
- TW-1580 "modified" attribute no longer updated (thanks to David Patrick).
- Setting 'bulk' to zero is interpreted as infinity, which means there is no - Setting 'bulk' to zero is interpreted as infinity, which means there is no
amount of changes that is considered dangerous (thanks to Tomas Babej). amount of changes that is considered dangerous (thanks to Tomas Babej).

View file

@ -598,7 +598,7 @@ void TDB2::update (
const std::string& uuid, const std::string& uuid,
Task& task, Task& task,
const bool add_to_backlog, const bool add_to_backlog,
const bool addition) const bool addition /* = false */)
{ {
// Validate to add metadata. // Validate to add metadata.
task.validate (false); task.validate (false);
@ -607,6 +607,13 @@ void TDB2::update (
Task original; Task original;
if (not addition && get (task.get ("uuid"), original)) if (not addition && get (task.get ("uuid"), original))
{ {
if (add_to_backlog)
{
// All locally modified tasks are timestamped, implicitly overwriting any
// changes the user or hooks tried to apply to the "modified" attribute.
task.setAsNow ("modified");
}
// Update the task, wherever it is. // Update the task, wherever it is.
if (!pending.modify_task (task)) if (!pending.modify_task (task))
completed.modify_task (task); completed.modify_task (task);