Adding e-mail notifications about mentions, follows, favourites and reblogs. Fixing another mention recording bug
This commit is contained in:
parent
e2b846f630
commit
2b116131d7
15 changed files with 185 additions and 12 deletions
4
app/mailers/application_mailer.rb
Normal file
4
app/mailers/application_mailer.rb
Normal file
|
@ -0,0 +1,4 @@
|
|||
class ApplicationMailer < ActionMailer::Base
|
||||
default from: (ENV['SMTP_FROM_ADDRESS'] || 'notifications@localhost')
|
||||
layout 'mailer'
|
||||
end
|
34
app/mailers/notification_mailer.rb
Normal file
34
app/mailers/notification_mailer.rb
Normal 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
|
Loading…
Add table
Add a link
Reference in a new issue