2016-11-15 15:56:29 +00:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2016-03-19 18:20:07 +00:00
|
|
|
class NotificationMailer < ApplicationMailer
|
|
|
|
helper StreamEntriesHelper
|
|
|
|
|
|
|
|
def mention(mentioned_account, status)
|
|
|
|
@me = mentioned_account
|
|
|
|
@status = status
|
|
|
|
|
2016-10-07 12:17:56 +01:00
|
|
|
return unless @me.user.settings(:notification_emails).mention
|
2016-11-16 16:51:02 +00:00
|
|
|
|
|
|
|
I18n.with_locale(@me.user.locale || I18n.default_locale) do
|
|
|
|
mail to: @me.user.email, subject: I18n.t('notification_mailer.mention.subject', name: @status.account.acct)
|
|
|
|
end
|
2016-03-19 18:20:07 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
def follow(followed_account, follower)
|
|
|
|
@me = followed_account
|
|
|
|
@account = follower
|
|
|
|
|
2016-10-07 12:17:56 +01:00
|
|
|
return unless @me.user.settings(:notification_emails).follow
|
2016-11-16 16:51:02 +00:00
|
|
|
|
|
|
|
I18n.with_locale(@me.user.locale || I18n.default_locale) do
|
|
|
|
mail to: @me.user.email, subject: I18n.t('notification_mailer.follow.subject', name: @account.acct)
|
|
|
|
end
|
2016-03-19 18:20:07 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
def favourite(target_status, from_account)
|
|
|
|
@me = target_status.account
|
|
|
|
@account = from_account
|
|
|
|
@status = target_status
|
|
|
|
|
2016-10-07 12:17:56 +01:00
|
|
|
return unless @me.user.settings(:notification_emails).favourite
|
2016-11-16 16:51:02 +00:00
|
|
|
|
|
|
|
I18n.with_locale(@me.user.locale || I18n.default_locale) do
|
|
|
|
mail to: @me.user.email, subject: I18n.t('notification_mailer.favourite.subject', name: @account.acct)
|
|
|
|
end
|
2016-03-19 18:20:07 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
def reblog(target_status, from_account)
|
|
|
|
@me = target_status.account
|
|
|
|
@account = from_account
|
|
|
|
@status = target_status
|
|
|
|
|
2016-10-07 12:17:56 +01:00
|
|
|
return unless @me.user.settings(:notification_emails).reblog
|
2016-11-16 16:51:02 +00:00
|
|
|
|
|
|
|
I18n.with_locale(@me.user.locale || I18n.default_locale) do
|
|
|
|
mail to: @me.user.email, subject: I18n.t('notification_mailer.reblog.subject', name: @account.acct)
|
|
|
|
end
|
2016-03-19 18:20:07 +00:00
|
|
|
end
|
|
|
|
end
|