monzo / response

Monzo's real-time incident response and reporting tool ⚡️
MIT License
1.52k stars 165 forks source link

Map slack IDs to user/channel in API serializers #173

Closed mattrco closed 4 years ago

mattrco commented 4 years ago

Adds an additional field to actions and timeline events so that slack IDs can be represented in human-readable form. These fields are read-only as updates should be applied to the non-mapped field.

Note: With the ability to turn off input sanitization in #171 it's possible to store < and > in the fields for these models verbatim. The regex that replaces slack IDs will currently only work in this case.

Where there is existing escaped data, we could either modify the regex to match escaped entities like &lt; or write a data migration to un-escape existing values. I've decided both of those are outside the scope of this PR ;)

mattrco commented 4 years ago

As discussed, I've added two new fields (details_ui and text_ui respectively) that represent the human-readable text. By default these are read-only.