mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-06-26 10:54:26 +02:00
Bug Fix - #171
- Fixed bug that caused redundant information to be displayed when the "done" command was run. Thanks to John Florian.
This commit is contained in:
parent
84f48fd056
commit
9095934bc0
3 changed files with 17 additions and 14 deletions
|
@ -25,6 +25,7 @@
|
|||
//
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include <iostream>
|
||||
#include "Permission.h"
|
||||
#include "Context.h"
|
||||
#include "util.h"
|
||||
|
@ -43,7 +44,7 @@ Permission::Permission ()
|
|||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
bool Permission::confirmed (const std::string& question)
|
||||
bool Permission::confirmed (const Task& task, const std::string& question)
|
||||
{
|
||||
if (!needConfirmation)
|
||||
return true;
|
||||
|
@ -51,6 +52,14 @@ bool Permission::confirmed (const std::string& question)
|
|||
if (allConfirmed)
|
||||
return true;
|
||||
|
||||
std::cout << std::endl
|
||||
<< "Task "
|
||||
<< task.id
|
||||
<< " \""
|
||||
<< task.get ("description")
|
||||
<< "\""
|
||||
<< std::endl;
|
||||
|
||||
int answer = confirm3 (question);
|
||||
if (answer == 2)
|
||||
allConfirmed = true;
|
||||
|
@ -58,6 +67,7 @@ bool Permission::confirmed (const std::string& question)
|
|||
if (answer > 0)
|
||||
return true;
|
||||
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -28,6 +28,7 @@
|
|||
#define INCLUDED_PERMISSION
|
||||
|
||||
#include <string>
|
||||
#include "Task.h"
|
||||
|
||||
class Permission
|
||||
{
|
||||
|
@ -38,7 +39,7 @@ public:
|
|||
|
||||
void bigChange () { needConfirmation = true; }
|
||||
void bigSequence () { needConfirmation = true; }
|
||||
bool confirmed (const std::string&);
|
||||
bool confirmed (const Task&, const std::string&);
|
||||
|
||||
private:
|
||||
bool needConfirmation;
|
||||
|
|
|
@ -763,9 +763,7 @@ std::string handleDone ()
|
|||
|
||||
if (taskDiff (before, *task))
|
||||
{
|
||||
std::cout << "Task " << before.id << " \"" << before.get ("description") << "\"" << std::endl;
|
||||
std::string question = taskDifferences (before, *task) + "Are you sure?";
|
||||
if (permission.confirmed (question))
|
||||
if (permission.confirmed (before, taskDifferences (before, *task) + "Are you sure?"))
|
||||
{
|
||||
context.tdb.update (*task);
|
||||
|
||||
|
@ -909,9 +907,7 @@ std::string handleModify ()
|
|||
|
||||
if (taskDiff (before, *other))
|
||||
{
|
||||
std::cout << "Task " << before.id << " \"" << before.get ("description") << "\"" << std::endl;
|
||||
std::string question = taskDifferences (before, *other) + "Are you sure?";
|
||||
if (changes && permission.confirmed (question))
|
||||
if (changes && permission.confirmed (before, taskDifferences (before, *task) + "Are you sure?"))
|
||||
{
|
||||
context.tdb.update (*other);
|
||||
++count;
|
||||
|
@ -970,9 +966,7 @@ std::string handleAppend ()
|
|||
|
||||
if (taskDiff (before, *other))
|
||||
{
|
||||
std::cout << "Task " << before.id << " \"" << before.get ("description") << "\"" << std::endl;
|
||||
std::string question = taskDifferences (before, *other) + "Are you sure?";
|
||||
if (changes && permission.confirmed (question))
|
||||
if (changes && permission.confirmed (before, taskDifferences (before, *task) + "Are you sure?"))
|
||||
{
|
||||
context.tdb.update (*other);
|
||||
|
||||
|
@ -1257,9 +1251,7 @@ std::string handleAnnotate ()
|
|||
|
||||
if (taskDiff (before, *task))
|
||||
{
|
||||
std::cout << "Task " << before.id << " \"" << before.get ("description") << "\"" << std::endl;
|
||||
std::string question = taskDifferences (before, *task) + "Are you sure?";
|
||||
if (permission.confirmed (question))
|
||||
if (permission.confirmed (before, taskDifferences (before, *task) + "Are you sure?"))
|
||||
{
|
||||
context.tdb.update (*task);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue