about summary refs log tree commit diff
path: root/app/mailers
diff options
context:
space:
mode:
authorEugen Rochko <eugen@zeonfederated.com>2016-10-07 13:17:56 +0200
committerEugen Rochko <eugen@zeonfederated.com>2016-10-07 13:17:56 +0200
commit06016453bd91882a53e91c11fc80f2c75fd474bb (patch)
tree1effbffae4db31206aff69efecb431407f70a924 /app/mailers
parent943c69c65d6410d1689d4494c9214c90654db56b (diff)
Adding user settings (model and mailer), no form yet
Diffstat (limited to 'app/mailers')
-rw-r--r--app/mailers/notification_mailer.rb5
1 files changed, 4 insertions, 1 deletions
diff --git a/app/mailers/notification_mailer.rb b/app/mailers/notification_mailer.rb
index 1414c2295..6c81df269 100644
--- a/app/mailers/notification_mailer.rb
+++ b/app/mailers/notification_mailer.rb
@@ -1,11 +1,11 @@
 class NotificationMailer < ApplicationMailer
   helper StreamEntriesHelper
-  helper AtomBuilderHelper
 
   def mention(mentioned_account, status)
     @me     = mentioned_account
     @status = status
 
+    return unless @me.user.settings(:notification_emails).mention
     mail to: @me.user.email, subject: "You were mentioned by #{@status.account.acct}"
   end
 
@@ -13,6 +13,7 @@ class NotificationMailer < ApplicationMailer
     @me      = followed_account
     @account = follower
 
+    return unless @me.user.settings(:notification_emails).follow
     mail to: @me.user.email, subject: "#{@account.acct} is now following you"
   end
 
@@ -21,6 +22,7 @@ class NotificationMailer < ApplicationMailer
     @account = from_account
     @status  = target_status
 
+    return unless @me.user.settings(:notification_emails).favourite
     mail to: @me.user.email, subject: "#{@account.acct} favourited your status"
   end
 
@@ -29,6 +31,7 @@ class NotificationMailer < ApplicationMailer
     @account = from_account
     @status  = target_status
 
+    return unless @me.user.settings(:notification_emails).reblog
     mail to: @me.user.email, subject: "#{@account.acct} reblogged your status"
   end
 end