Clean up Banzai HTML for HipChat

The `class` and `data-*` attributes are meaningless in HipChat, and it
would probably be better to limit the tags, too. For example, we could
avoid block-level elements in `render_line`.
This commit is contained in:
David Eisner 2016-10-04 16:27:40 +01:00 committed by Airat Shigapov
parent b434b75fd0
commit aa2406e0f8
No known key found for this signature in database
GPG Key ID: 95B04300D2844C47
1 changed files with 3 additions and 0 deletions

View File

@ -1,4 +1,6 @@
class HipchatService < Service
include ActionView::Helpers::SanitizeHelper
MAX_COMMITS = 3
prop_accessor :token, :room, :server, :notify, :color, :api_version
@ -138,6 +140,7 @@ class HipchatService < Service
html = Banzai.render(text, context)
html = Banzai.post_process(html, context)
sanitize html, attributes: %w(href title alt)
else
""
end