docbrown/app/sanitizers/comment_email_scrubber.rb
Philip How 2129ae145b
Update style for new reply email (#20861)
* update style for new reply email

* Truncate and sanitize comment

* rubocop

* fix links, fix stop send when no content
2024-04-19 08:56:16 -04:00

17 lines
512 B
Ruby

class CommentEmailScrubber < Rails::Html::PermitScrubber
def initialize
super
self.tags = MarkdownProcessor::AllowedTags::EMAIL_COMMENT
self.attributes = MarkdownProcessor::AllowedAttributes::EMAIL_COMMENT
end
def allowed_node?(node)
tags.include?(node.name) && node.children.present?
end
# The default behavior of PermitScrubber removes the <script> tags
# but keeps the contents and this is required to fix that
def skip_node?(node)
node.name == "script" || super
end
end