From 33dcea68f53d51b6335a9478098402be499e34d4 Mon Sep 17 00:00:00 2001 From: Max Rossmannek Date: Sat, 12 Dec 2020 19:24:12 +0100 Subject: [PATCH] Un-wait a waiting task when done Implements #2322 --- src/commands/CmdDone.cpp | 4 ++++ test/wait.t | 16 ++++++++++++++++ 2 files changed, 20 insertions(+) diff --git a/src/commands/CmdDone.cpp b/src/commands/CmdDone.cpp index 274f2b3a9..4a853ecfa 100644 --- a/src/commands/CmdDone.cpp +++ b/src/commands/CmdDone.cpp @@ -94,6 +94,10 @@ int CmdDone::execute (std::string&) task.addAnnotation (Context::getContext ().config.get ("journal.time.stop.annotation")); } + // Un-wait the task, if waiting. + if (task.has ("wait")) + task.remove ("wait"); + if (permission (taskDifferences (before, task) + question, filtered.size ())) { updateRecurrenceMask (task); diff --git a/test/wait.t b/test/wait.t index 5530f386d..e1bb60e5a 100755 --- a/test/wait.t +++ b/test/wait.t @@ -100,6 +100,22 @@ class Test1486(TestCase): self.assertNotIn('regular', out) +class TestFeature2322(TestCase): + def setUp(self): + """Executed before each test in the class""" + self.t = Task() + + def test_done_unwait(self): + """2322: Done should un-wait a waiting task""" + self.t("add foo wait:tomorrow") + code, out, err = self.t("export") + self.assertIn('"wait":', out) + + self.t("1 done") + code, out, err = self.t("export") + self.assertNotIn('"wait":', out) + + if __name__ == "__main__": from simpletap import TAPTestRunner unittest.main(testRunner=TAPTestRunner())