3
0
Fork 0

fix: expose transaction comment for version history

This commit is contained in:
Lance Edgar 2025-12-18 23:01:26 -06:00
parent 2723965a6a
commit 7c6bdb404e
3 changed files with 14 additions and 1 deletions

View file

@ -24,6 +24,10 @@
<span>${transaction.id}</span>
</b-field>
<b-field label="Comment" horizontal>
<span>${transaction.meta.get("comment", "")}</span>
</b-field>
</div>
<div style="padding: 2rem;">

View file

@ -1145,6 +1145,7 @@ class MasterView(View): # pylint: disable=too-many-public-methods
"issued_at",
"user",
"remote_addr",
"comment",
]
def get_version_grid_data(self, instance):
@ -1197,6 +1198,14 @@ class MasterView(View): # pylint: disable=too-many-public-methods
# remote_addr
g.set_label("remote_addr", "IP Address")
# comment
g.set_renderer("comment", self.render_version_comment)
def render_version_comment( # pylint: disable=missing-function-docstring,unused-argument
self, txn, key, value
):
return txn.meta.get("comment", "")
def view_version(self): # pylint: disable=too-many-locals
"""
View to show diff details for a particular object version.

View file

@ -2115,7 +2115,7 @@ class TestVersionedMasterView(VersionWebTestCase):
view = self.make_view()
self.assertEqual(
view.get_version_grid_columns(),
["id", "issued_at", "user", "remote_addr"],
["id", "issued_at", "user", "remote_addr", "comment"],
)
# custom