Adding e-mail notifications about mentions, follows, favourites and reblogs. Fixing another mention recording bug

This commit is contained in:
Eugen Rochko 2016-03-19 19:20:07 +01:00
parent e2b846f630
commit 2b116131d7
15 changed files with 185 additions and 12 deletions

View file

@ -0,0 +1,4 @@
class ApplicationMailer < ActionMailer::Base
default from: (ENV['SMTP_FROM_ADDRESS'] || 'notifications@localhost')
layout 'mailer'
end

View file

@ -0,0 +1,34 @@
class NotificationMailer < ApplicationMailer
helper StreamEntriesHelper
helper AtomBuilderHelper
def mention(mentioned_account, status)
@me = mentioned_account
@status = status
mail to: @me.user.email, subject: "You were mentioned by #{@status.account.acct}"
end
def follow(followed_account, follower)
@me = followed_account
@account = follower
mail to: @me.user.email, subject: "#{@account.acct} is now following you"
end
def favourite(target_status, from_account)
@me = target_status.account
@account = from_account
@status = target_status
mail to: @me.user.email, subject: "#{@account.acct} favourited your status"
end
def reblog(target_status, from_account)
@me = target_status.account
@account = from_account
@status = target_status
mail to: @me.user.email, subject: "#{@account.acct} reblogged your status"
end
end