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:
parent
b434b75fd0
commit
aa2406e0f8
|
@ -1,4 +1,6 @@
|
||||||
class HipchatService < Service
|
class HipchatService < Service
|
||||||
|
include ActionView::Helpers::SanitizeHelper
|
||||||
|
|
||||||
MAX_COMMITS = 3
|
MAX_COMMITS = 3
|
||||||
|
|
||||||
prop_accessor :token, :room, :server, :notify, :color, :api_version
|
prop_accessor :token, :room, :server, :notify, :color, :api_version
|
||||||
|
@ -138,6 +140,7 @@ class HipchatService < Service
|
||||||
|
|
||||||
html = Banzai.render(text, context)
|
html = Banzai.render(text, context)
|
||||||
html = Banzai.post_process(html, context)
|
html = Banzai.post_process(html, context)
|
||||||
|
sanitize html, attributes: %w(href title alt)
|
||||||
else
|
else
|
||||||
""
|
""
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue