changeset 8983:6cb54b9ef4de stable

api: include creation date in comments
author Manuel Jacob <me@manueljacob.de>
date Wed, 29 Mar 2023 13:01:32 +0200
parents a136383459ef
children 55715fe0a8e1
files kallithea/model/db.py kallithea/tests/api/api_base.py
diffstat 2 files changed, 5 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/kallithea/model/db.py	Wed Mar 29 11:59:07 2023 +0200
+++ b/kallithea/model/db.py	Wed Mar 29 13:01:32 2023 +0200
@@ -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,
         )
 
--- a/kallithea/tests/api/api_base.py	Wed Mar 29 11:59:07 2023 +0200
+++ b/kallithea/tests/api/api_base.py	Wed Mar 29 13:01:32 2023 +0200
@@ -2517,6 +2517,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
 
@@ -2537,6 +2538,7 @@
                     'comment_id': commentobj.comment_id,
                     'text': 'example inline comment',
                     'username': 'test_admin',
+                    'created_on': commentobj.created_on.replace(microsecond=0).isoformat(),
                 }]
             }]
         ]
@@ -2584,7 +2586,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",