gearheads
/
mastodon
Archived
2
0
Fork 0
This repository has been archived on 2024-06-09. You can view files and clone it, but cannot push or open issues/pull-requests.
mastodon/app/mailers/notification_mailer.rb

52 lines
1.6 KiB
Ruby
Raw Normal View History

# frozen_string_literal: true
class NotificationMailer < ApplicationMailer
helper StreamEntriesHelper
def mention(mentioned_account, status)
@me = mentioned_account
@status = status
return unless @me.user.settings(:notification_emails).mention
2016-11-16 17:51:02 +01: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
end
def follow(followed_account, follower)
@me = followed_account
@account = follower
return unless @me.user.settings(:notification_emails).follow
2016-11-16 17:51:02 +01: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
end
def favourite(target_status, from_account)
@me = target_status.account
@account = from_account
@status = target_status
return unless @me.user.settings(:notification_emails).favourite
2016-11-16 17:51:02 +01: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
end
def reblog(target_status, from_account)
@me = target_status.account
@account = from_account
@status = target_status
return unless @me.user.settings(:notification_emails).reblog
2016-11-16 17:51:02 +01: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
end
end