2023-02-21 16:55:31 -08:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2016-03-19 11:20:07 -07:00
|
|
|
# Preview all emails at http://localhost:3000/rails/mailers/notification_mailer
|
2018-01-15 18:29:11 -08:00
|
|
|
|
2016-03-19 11:20:07 -07:00
|
|
|
class NotificationMailerPreview < ActionMailer::Preview
|
|
|
|
# Preview this email at http://localhost:3000/rails/mailers/notification_mailer/mention
|
|
|
|
def mention
|
2023-07-09 18:06:22 -07:00
|
|
|
activity = Mention.last
|
|
|
|
mailer_for(activity.account, activity).mention
|
2016-03-19 11:20:07 -07:00
|
|
|
end
|
|
|
|
|
|
|
|
# Preview this email at http://localhost:3000/rails/mailers/notification_mailer/follow
|
|
|
|
def follow
|
2023-07-09 18:06:22 -07:00
|
|
|
activity = Follow.last
|
|
|
|
mailer_for(activity.target_account, activity).follow
|
2016-03-19 11:20:07 -07:00
|
|
|
end
|
|
|
|
|
2018-01-16 11:20:15 -08:00
|
|
|
# Preview this email at http://localhost:3000/rails/mailers/notification_mailer/follow_request
|
|
|
|
def follow_request
|
2023-07-09 18:06:22 -07:00
|
|
|
activity = Follow.last
|
|
|
|
mailer_for(activity.target_account, activity).follow_request
|
2018-01-16 11:20:15 -08:00
|
|
|
end
|
|
|
|
|
2016-03-19 11:20:07 -07:00
|
|
|
# Preview this email at http://localhost:3000/rails/mailers/notification_mailer/favourite
|
|
|
|
def favourite
|
2023-07-09 18:06:22 -07:00
|
|
|
activity = Favourite.last
|
|
|
|
mailer_for(activity.status.account, activity).favourite
|
2016-03-19 11:20:07 -07:00
|
|
|
end
|
|
|
|
|
|
|
|
# Preview this email at http://localhost:3000/rails/mailers/notification_mailer/reblog
|
|
|
|
def reblog
|
2023-07-09 18:06:22 -07:00
|
|
|
activity = Status.where.not(reblog_of_id: nil).first
|
|
|
|
mailer_for(activity.reblog.account, activity).reblog
|
|
|
|
end
|
|
|
|
|
|
|
|
private
|
|
|
|
|
|
|
|
def mailer_for(account, activity)
|
|
|
|
NotificationMailer.with(
|
|
|
|
recipient: account,
|
|
|
|
notification: Notification.find_by(activity: activity)
|
|
|
|
)
|
2016-03-19 11:20:07 -07:00
|
|
|
end
|
|
|
|
end
|