From 6546c050c5984b4d99a6ca526a1f52b175432116 Mon Sep 17 00:00:00 2001 From: Max Rossmannek Date: Tue, 6 Apr 2021 14:59:57 +0200 Subject: [PATCH] Un-wait a waiting task when deleted --- src/commands/CmdDelete.cpp | 4 ++++ test/wait.t | 10 ++++++++++ 2 files changed, 14 insertions(+) diff --git a/src/commands/CmdDelete.cpp b/src/commands/CmdDelete.cpp index 0c68e6e40..ac2e2aefd 100644 --- a/src/commands/CmdDelete.cpp +++ b/src/commands/CmdDelete.cpp @@ -89,6 +89,10 @@ int CmdDelete::execute (std::string&) if (! task.has ("end")) task.setAsNow ("end"); + // Un-wait the task, if waiting. + if (task.has ("wait")) + task.remove ("wait"); + if (permission (question, filtered.size ())) { updateRecurrenceMask (task); diff --git a/test/wait.t b/test/wait.t index e1bb60e5a..489a8318f 100755 --- a/test/wait.t +++ b/test/wait.t @@ -115,6 +115,16 @@ class TestFeature2322(TestCase): code, out, err = self.t("export") self.assertNotIn('"wait":', out) + def test_delete_unwait(self): + """2322: Deleteion should un-wait a waiting task""" + self.t("add bar wait:tomorrow") + code, out, err = self.t("export") + self.assertIn('"wait":', out) + + self.t("1 delete", input="y\n") + code, out, err = self.t("export") + self.assertNotIn('"wait":', out) + if __name__ == "__main__": from simpletap import TAPTestRunner