FIX: Anonymous users cannot encrypt PMs (#130)

FIX: Anonymous users cannot encrypt PMs (#130)

The can_encrypt? method returned true for unauthenticated users if encrypt_groups was blank. Otherwise, it was raising an error because groups method was undefined.

diff --git a/plugin.rb b/plugin.rb
index 9849878..d3427af 100644
--- a/plugin.rb
+++ b/plugin.rb
@@ -120,6 +120,7 @@ after_initialize do
 
   add_to_class(:guardian, :can_encrypt?) do
     return false if !SiteSetting.encrypt_enabled?
+    return false if !authenticated?
     return true if SiteSetting.encrypt_groups.empty?
 
     encrypt_groups = SiteSetting.encrypt_groups.split('|').map(&:downcase)

GitHub sha: 6215fba2658fe295f96fd37c0a8cf4ffe6328658

This commit appears in #130 which was approved by SamSaffron. It was merged by SamSaffron.