diff options
| author | Ben Sima <ben@bensima.com> | 2025-12-01 07:40:49 -0500 |
|---|---|---|
| committer | Ben Sima <ben@bensima.com> | 2025-12-01 07:40:49 -0500 |
| commit | 4919cf825d4fdbcecc1f69fcf2a32176dfdde5ac (patch) | |
| tree | 0853eef48784ffb840589ddfdd305de7507f11cd /Omni/Task.hs | |
| parent | e3f20289bdf3014b418367931fbd9cf96239061a (diff) | |
Add author field to task comments (Human vs Junior)
Comments now track whether they were made by a Human or by Junior
(the agent). The CommentAuthor type is stored in the database and
displayed in the web UI with styled badges.
Task-Id: t-201
Diffstat (limited to 'Omni/Task.hs')
| -rw-r--r-- | Omni/Task.hs | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/Omni/Task.hs b/Omni/Task.hs index 11d080b..3a68fa5 100644 --- a/Omni/Task.hs +++ b/Omni/Task.hs @@ -286,7 +286,7 @@ move' args | args `Cli.has` Cli.command "comment" = do tid <- getArgText args "id" message <- getArgText args "message" - updatedTask <- addComment tid message + updatedTask <- addComment tid message Human if isJsonMode args then outputJson updatedTask else putStrLn <| "Added comment to task: " <> T.unpack tid @@ -873,24 +873,28 @@ unitTests = (parseQueryParam "Done" :: Either Text Status) Test.@?= Right Done, Test.unit "can add comment to task" <| do task <- createTask "Task with comment" WorkTask Nothing Nothing P2 Nothing [] "Description" - updatedTask <- addComment (taskId task) "This is a test comment" + updatedTask <- addComment (taskId task) "This is a test comment" Human length (taskComments updatedTask) Test.@?= 1 case taskComments updatedTask of - (c : _) -> commentText c Test.@?= "This is a test comment" + (c : _) -> do + commentText c Test.@?= "This is a test comment" + commentAuthor c Test.@?= Human [] -> Test.assertFailure "Expected at least one comment", Test.unit "can add multiple comments to task" <| do task <- createTask "Task with comments" WorkTask Nothing Nothing P2 Nothing [] "Description" - _ <- addComment (taskId task) "First comment" - updatedTask <- addComment (taskId task) "Second comment" + _ <- addComment (taskId task) "First comment" Junior + updatedTask <- addComment (taskId task) "Second comment" Human length (taskComments updatedTask) Test.@?= 2 case taskComments updatedTask of (c1 : c2 : _) -> do commentText c1 Test.@?= "First comment" + commentAuthor c1 Test.@?= Junior commentText c2 Test.@?= "Second comment" + commentAuthor c2 Test.@?= Human _ -> Test.assertFailure "Expected at least two comments", Test.unit "comments are persisted" <| do task <- createTask "Persistent comments" WorkTask Nothing Nothing P2 Nothing [] "Description" - _ <- addComment (taskId task) "Persisted comment" + _ <- addComment (taskId task) "Persisted comment" Junior tasks <- loadTasks case findTask (taskId task) tasks of Nothing -> Test.assertFailure "Could not reload task" |
