warehouse
warehouse copied to clipboard
Audit event prettification with a Jinja2 filter
#6339 contains a long conditional to prettify audit events for user display. We should look into replacing it with a Jinja2 filter + some kind of lookup table for ease of maintenance and future event addition.
cc @nlhkabu
In #15702 I used a set _mapping_ = { tag_name = "heading" ... } and then referred to that in the elif list to reduce some duplication. Maybe that could be a good first pass. Many of the messages could be accounted for that way.
While doing that PR, I found it annoying to have to go through the source files to find the additional data appended to each event ... but honestly, changing those enums to more structured/controlled objects with additional presentation data doesn't seem like ROI would be worth it.