[PATCH] api: include creation date in comments

Manuel Jacob me at manueljacob.de
Wed Mar 29 11:01:48 UTC 2023


# HG changeset patch
# User Manuel Jacob <me at manueljacob.de>
# Date 1680087692 -7200
#      Wed Mar 29 13:01:32 2023 +0200
# Node ID 44e34dcb73b1d1cf6a7527094521ab97968d8396
# Parent  d2166e7ea65797fdccb548cd9cf416c8ed02fc6b
# EXP-Topic api-comments
api: include creation date in comments

diff --git a/kallithea/model/db.py b/kallithea/model/db.py
--- a/kallithea/model/db.py
+++ b/kallithea/model/db.py
@@ -1914,6 +1914,7 @@
         return dict(
             comment_id=self.comment_id,
             username=self.author.username,
+            created_on=self.created_on.replace(microsecond=0),
             text=self.text,
         )
 
diff --git a/kallithea/tests/api/api_base.py b/kallithea/tests/api/api_base.py
--- a/kallithea/tests/api/api_base.py
+++ b/kallithea/tests/api/api_base.py
@@ -2413,6 +2413,7 @@
             'comment_id': commentobj.comment_id,
             'text': 'example changeset comment',
             'username': 'test_admin',
+            'created_on': commentobj.created_on.replace(microsecond=0).isoformat(),
         }
         assert comment == expected
 
@@ -2433,6 +2434,7 @@
                     'comment_id': commentobj.comment_id,
                     'text': 'example inline comment',
                     'username': 'test_admin',
+                    'created_on': commentobj.created_on.replace(microsecond=0).isoformat(),
                 }]
             }]
         ]
@@ -2480,7 +2482,8 @@
             "org_ref_parts": ["branch", "stable", self.TEST_PR_SRC],
             "other_ref_parts": ["branch", "default", self.TEST_PR_DST],
             "comments": [{"username": base.TEST_USER_ADMIN_LOGIN, "text": "",
-                         "comment_id": pullrequest.comments[0].comment_id}],
+                          "comment_id": pullrequest.comments[0].comment_id,
+                          "created_on": "2000-01-01T00:00:00"}],
             "owner": base.TEST_USER_ADMIN_LOGIN,
             "statuses": [{"status": "under_review", "reviewer": base.TEST_USER_ADMIN_LOGIN, "modified_at": "2000-01-01T00:00:00"} for i in range(0, len(self.TEST_PR_REVISIONS))],
             "title": "get test",



More information about the kallithea-general mailing list