From 10270593a49664df35bff54f4dde276e60bfe879 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9gis=20Hanol?= Date: Sun, 26 Apr 2015 00:37:27 +0200 Subject: [PATCH] FIX: remove links in poll email notification --- lib/email/html_cleaner.rb | 7 ++++--- plugins/poll/plugin.rb | 5 +++++ 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/lib/email/html_cleaner.rb b/lib/email/html_cleaner.rb index 96f6d313e..e8c89f7a1 100644 --- a/lib/email/html_cleaner.rb +++ b/lib/email/html_cleaner.rb @@ -7,9 +7,10 @@ module Email # Elements to hoist all children out of HTML_HOIST_ELEMENTS = %w(div span font table tbody th tr td) # Node types to always delete - HTML_DELETE_ELEMENT_TYPES = [Nokogiri::XML::Node::DTD_NODE, - Nokogiri::XML::Node::COMMENT_NODE, - ] + HTML_DELETE_ELEMENT_TYPES = [ + Nokogiri::XML::Node::DTD_NODE, + Nokogiri::XML::Node::COMMENT_NODE, + ] # Private variables: # @doc - nokogiri document diff --git a/plugins/poll/plugin.rb b/plugins/poll/plugin.rb index d6b6181e2..e0b403fe8 100644 --- a/plugins/poll/plugin.rb +++ b/plugins/poll/plugin.rb @@ -14,6 +14,11 @@ VOTES_CUSTOM_FIELD ||= "polls-votes".freeze after_initialize do + # remove "Vote Now!" & "Show Results" links in emails + Email::Styles.register_plugin_style do |fragment| + fragment.css(".poll a.cast-votes, .poll a.toggle-results").each(&:remove) + end + module ::DiscoursePoll class Engine < ::Rails::Engine engine_name PLUGIN_NAME