Refactor task diffs to handle new attributes
This refactors task(Info)Differences to be methods of Task and to correctly handle the `annotation_`, `tags_`, and `dep_` attributes.
This commit is contained in:
committed by
Tomas Babej
parent
7aee9567a3
commit
309e99d49e
@@ -84,7 +84,7 @@ int CmdAnnotate::execute (std::string&)
|
||||
|
||||
task.modify (Task::modAnnotate, true);
|
||||
|
||||
if (permission (taskDifferences (before, task) + question, filtered.size ()))
|
||||
if (permission (before.diff (task) + question, filtered.size ()))
|
||||
{
|
||||
Context::getContext ().tdb2.modify (task);
|
||||
++count;
|
||||
|
||||
@@ -84,7 +84,7 @@ int CmdAppend::execute (std::string&)
|
||||
|
||||
task.modify (Task::modAppend, true);
|
||||
|
||||
if (permission (taskDifferences (before, task) + question, filtered.size ()))
|
||||
if (permission (before.diff (task) + question, filtered.size ()))
|
||||
{
|
||||
Context::getContext ().tdb2.modify (task);
|
||||
++count;
|
||||
|
||||
@@ -134,7 +134,7 @@ int CmdDenotate::execute (std::string&)
|
||||
task.identifier (true),
|
||||
task.get ("description"));
|
||||
|
||||
if (permission (taskDifferences (before, task) + question, filtered.size ()))
|
||||
if (permission (before.diff (task) + question, filtered.size ()))
|
||||
{
|
||||
++count;
|
||||
Context::getContext ().tdb2.modify (task);
|
||||
|
||||
@@ -98,7 +98,7 @@ int CmdDone::execute (std::string&)
|
||||
task.addAnnotation (Context::getContext ().config.get ("journal.time.stop.annotation"));
|
||||
}
|
||||
|
||||
if (permission (taskDifferences (before, task) + question, filtered.size ()))
|
||||
if (permission (before.diff (task) + question, filtered.size ()))
|
||||
{
|
||||
updateRecurrenceMask (task);
|
||||
Context::getContext ().tdb2.modify (task);
|
||||
|
||||
@@ -571,7 +571,7 @@ int CmdInfo::execute (std::string& output)
|
||||
|
||||
Task before (undo[previous].substr (4));
|
||||
Task after (undo[current].substr (4));
|
||||
journal.set (row, 1, taskInfoDifferences (before, after, dateformat, last_timestamp, Datetime(after.get("modified")).toEpoch()));
|
||||
journal.set (row, 1, before.diffForInfo (after, dateformat, last_timestamp, Datetime(after.get("modified")).toEpoch()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -88,7 +88,7 @@ int CmdModify::execute (std::string&)
|
||||
task.identifier (true),
|
||||
task.get ("description"));
|
||||
|
||||
if (permission (taskDifferences (before, task) + question, filtered.size ()))
|
||||
if (permission (before.diff (task) + question, filtered.size ()))
|
||||
{
|
||||
count += modifyAndUpdate (before, task, &projectChanges);
|
||||
}
|
||||
|
||||
@@ -84,7 +84,7 @@ int CmdPrepend::execute (std::string&)
|
||||
|
||||
task.modify (Task::modPrepend, true);
|
||||
|
||||
if (permission (taskDifferences (before, task) + question, filtered.size ()))
|
||||
if (permission (before.diff (task) + question, filtered.size ()))
|
||||
{
|
||||
Context::getContext ().tdb2.modify (task);
|
||||
++count;
|
||||
|
||||
@@ -96,7 +96,7 @@ int CmdStart::execute (std::string&)
|
||||
if (Context::getContext ().config.getBoolean ("journal.time"))
|
||||
task.addAnnotation (Context::getContext ().config.get ("journal.time.start.annotation"));
|
||||
|
||||
if (permission (taskDifferences (before, task) + question, filtered.size ()))
|
||||
if (permission (before.diff (task) + question, filtered.size ()))
|
||||
{
|
||||
updateRecurrenceMask (task);
|
||||
Context::getContext ().tdb2.modify (task);
|
||||
|
||||
@@ -87,7 +87,7 @@ int CmdStop::execute (std::string&)
|
||||
if (Context::getContext ().config.getBoolean ("journal.time"))
|
||||
task.addAnnotation (Context::getContext ().config.get ("journal.time.stop.annotation"));
|
||||
|
||||
if (permission (taskDifferences (before, task) + question, filtered.size ()))
|
||||
if (permission (before.diff (task) + question, filtered.size ()))
|
||||
{
|
||||
updateRecurrenceMask (task);
|
||||
Context::getContext ().tdb2.modify (task);
|
||||
|
||||
Reference in New Issue
Block a user