graylog2-server icon indicating copy to clipboard operation
graylog2-server copied to clipboard

Add notification template without escaping

Open patrickmann opened this issue 1 year ago • 2 comments

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.

patrickmann avatar Feb 06 '24 07:02 patrickmann

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).

patrickmann avatar Feb 21 '24 16:02 patrickmann

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).

mpfz0r avatar Feb 22 '24 10:02 mpfz0r

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.

patrickmann avatar Mar 05 '24 11:03 patrickmann