docbrown/spec/mailers/previews/notify_mailer_preview.rb
Michael Kohl 09828853f6
✂✂✂ Remove Connect (#14734)
* Remove Connect

* Remove more Connect specs

* Remove a lot more Connect code

* 🚮

* It all has to go

* Explicitly add httpclient

* Update application layout

* Remove messages association from User

* Start fixing specs

* reintroduce util function and refactor references

* Remove Connect Cypress test

* Fix more specs

* Remove Connect from listings

* Ignore contact_via_connect column on listings

* Remove contact_via_connect usages

* Ignore mod_chat_channel_id on tags

* Drop Connect tables

* Remove email_connect_messages from user notification settings

* Re-add httpclient 2.8.3

This was mistakenly removed as a merge conflict

* Don't need to exclude removed chat channel file

* Remove unneeded style for chat channels

* Remove unneeded channel list prop type

* Remove chat channels index/connect-link from getPageEntries

* Re-add comment from httpclient in Gemfile

* Remove connect references from mailers

Tag Moderators no longer have a chat channel

No longer will users be notified about new messages (there won't be
any)

No longer will users be notified about channel invites (you can't
invite anyone anymore)

* Don't configure Pusher and remove PUSHER_* from .env_sample

since it's removed from gemfile, the Pusher constant will not resolve, if this is
configured in the environment variables we'll fail to boot.

Co-authored-by: Suzanne Aitchison <suzanne@forem.com>
Co-authored-by: Dan Uber <dan@forem.com>
2021-11-18 08:21:00 -06:00

86 lines
2.6 KiB
Ruby

# Preview all emails at http://localhost:3000/rails/mailers/notify_mailer
class NotifyMailerPreview < ActionMailer::Preview
def new_reply_email
NotifyMailer.with(comment: Comment.first).new_reply_email
end
def new_follower_email
follow = User.first.follow(User.last)
NotifyMailer.with(follow: follow).new_follower_email
end
def unread_notifications_email
NotifyMailer.with(user: User.last).unread_notifications_email
end
def new_comment_mention_email
mention = Mention.find_or_create_by(user: User.find(1), mentionable: Comment.find(1))
NotifyMailer.with(mention: mention).new_mention_email
end
def new_article_mention_email
mention = Mention.find_or_create_by(user: User.find(1), mentionable: Article.find(1))
NotifyMailer.with(mention: mention).new_mention_email
end
def video_upload_complete_email
NotifyMailer.with(article: Article.last).video_upload_complete_email
end
def new_badge_email
badge_achievement = BadgeAchievement.find_or_create_by(
user: User.find(1),
badge: Badge.find(1),
rewarder: User.find(2),
rewarding_context_message: "You made it!",
)
NotifyMailer.with(badge_achievement: badge_achievement).new_badge_email
end
def tag_moderator_confirmation_email
NotifyMailer.with(user: User.first, tag: Tag.find(1)).tag_moderator_confirmation_email
end
def trusted_role_email
NotifyMailer.with(user: User.first).trusted_role_email
end
def feedback_message_resolution_email
# change email_body text when you need to see a different version
@user = User.first
email_body = <<~HEREDOC
Hi [*USERNAME*],
We wanted to say thank you for flagging a [comment/post] that was in violation of the dev.to
code of conduct and terms of service. Your action has helped us continue our work of
fostering an open and welcoming community.
We've also removed the offending posts and reached out to the offender(s).
Thanks again for being a great part of the community.
PBJ
HEREDOC
params = {
email_to: @user.email,
email_subject: "Courtesy notice from #{Settings::Community.community_name}",
email_body: email_body,
email_type: "Reporter",
feedback_message_id: rand(100)
}
NotifyMailer.with(params).feedback_message_resolution_email
end
def new_message_email
NotifyMailer.with(message: Message.last).new_message_email
end
def account_deleted_email
user = User.last
NotifyMailer.with(name: user.name, email: user.email).account_deleted_email
end
def export_email
NotifyMailer.with(user: User.last, attachment: "attachment").export_email
end
end