UX: Add instructions to encrypted cooked message.

UX: Add instructions to encrypted cooked message.

diff --git a/config/locales/client.en.yml b/config/locales/client.en.yml
index 85584f2..6d8aa14 100644
--- a/config/locales/client.en.yml
+++ b/config/locales/client.en.yml
@@ -6,7 +6,8 @@ en:
       decryption_failed: "This message could not be decrypted."
 
       encrypted_topic_title: "A secret message"
-      encrypted_topic_raw: "This is a secret message that has been end-to-end encrypted."
+      encrypted_post: "This is a secret message with end to end encryption. To view it, you must be invited to this topic."
+      encrypted_post_email: "This is a secret message with end to end encryption. You must visit the topic to view it."
       encrypted_icon_title: "This message is end-to-end encrypted."
 
       encrypted_uploads: "Uploads cannot be encrypted at this time."
diff --git a/plugin.rb b/plugin.rb
index 0fee16d..4646531 100644
--- a/plugin.rb
+++ b/plugin.rb
@@ -124,12 +124,19 @@ after_initialize do
   # Hide cooked content.
   Plugin::Filter.register(:after_post_cook) do |post, cooked|
     if post.is_encrypted? && post.raw.match(/\A[A-Za-z0-9+\\\/=]+\Z/)
-      next "<p>#{I18n.t('js.encrypt.encrypted_topic_raw')}</p>"
+      next "<p>#{I18n.t('js.encrypt.encrypted_post')}</p>"
     end
 
     cooked
   end
 
+  # Hide cooked content in email.
+  on(:reduce_cooked) do |fragment, post|
+    if post && post.is_encrypted? && post.raw.match(/\A[A-Za-z0-9+\\\/=]+\Z/)
+      fragment.inner_html = "<p>#{I18n.t('js.encrypt.encrypted_post_email')}</p>"
+    end
+  end
+
   # Handle new post creation.
   add_permitted_post_create_param(:encrypted_title)
   add_permitted_post_create_param(:encrypted_raw)

GitHub sha: 87874514