graylog2-server
graylog2-server copied to clipboard
Add notification template without escaping
Resolves Graylog2/graylog-plugin-enterprise#6525
Provides a notification template that does not escape parameter strings. This is useful if the message is supposed to contain HTML characters, e.g. "Index <i1> is unavailable".
How Has This Been Tested?
Unit test and hand-crafted notifications
Types of changes
- [ ] Bug fix (non-breaking change which fixes an issue)
- [x] New feature (non-breaking change which adds functionality)
- [ ] Refactoring (non-breaking change)
- [ ] Breaking change (fix or feature that would cause existing functionality to change)
Checklist:
- [x] My code follows the code style of this project.
- [ ] My change requires a change to the documentation.
- [ ] I have updated the documentation accordingly.
- [ ] I have read the CONTRIBUTING document.
- [x] I have added tests to cover my changes.
So the requirement is:
- titles are not escaped and not interpreted as HTML
- descriptions are escaped and interpreted as HTML We can use Freemarker directives to assign plaintext format to the titles; and leave descriptions as is (HTLM output format).
So the requirement is:
* titles are not escaped and not interpreted as HTML
I wouldn't make the distinction between titles and descriptions. Titles just shouldn't be escaped twice . I suggest we just treat them as raw html like we do for the description. See my comment and patch on the other PR.
* descriptions are escaped and interpreted as HTML We can use Freemarker directives to assign plaintext format to the titles; and leave descriptions as is (HTLM output format).
I went with your initial suggestion of modifying rendering of titles in the FE. It achieves the desired outcome and doesn't require any changes to templates.