[deploy] Update our mailers to be generalized (#7359)

* feat: make the from in the email to be dynamic

* feat: hardcoded mailer dev.to

* feat: oops hardcoded email addresses in the terms

* chore: remove some whitespace

* update editor guide

* feat: new reply email

* feat: new message mailer

* feat: new follower email

* feat: capitalize the button

* feat: rename the link

* feat: capitalize the button

* feat: generalize the urls

* feat: generalise the url

* feat: dynamic DEV

* feat: update the specs

* feat: DEV digest generalisation part 1

* fix: the method is accessed by tag_url and so the default parameter needs to be set at this level and not at self.tag

* fix: use the tag model instance instead of passing through just the tag name (so that we can use tag_url)

* chore: make code climate happy

* chore: more robocop

* feat: add a default url back for self.tag

* test: fix the feedback helper spec

* fix: spec to be general

* fix: oops :(

* refactor: user_settings_path

* chore: use code_of_conduct_path

* chore: robocop

* chore: use connect path

* chore; use the notifications symbol

* chore: misc path

* feat: simplify url

* feat/fix: change the order of the helpers and use user_url

* chore: user_url

* capitalise

* chore: update article path
This commit is contained in:
Ridhwana 2020-04-17 21:35:35 +02:00 committed by GitHub
parent f2ee0378f9
commit 6dbc838bae
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
32 changed files with 96 additions and 93 deletions

View file

@ -1,5 +1,3 @@
function initializeCommentsPage() {
if (document.getElementById('comments-container')) {
toggleCodeOfConduct();

View file

@ -194,7 +194,7 @@ module ApplicationHelper
URL.reaction(reaction)
end
def tag_url(tag, page)
def tag_url(tag, page = 1)
URL.tag(tag, page)
end

View file

@ -40,6 +40,6 @@ module FeedbackMessagesHelper
DEV Team
HEREDOC
{ subject: "Courtesy Notice from DEV", body: body }.freeze
{ subject: "Courtesy Notice from #{ApplicationConfig['COMMUNITY_NAME']}", body: body }.freeze
end
end

View file

@ -17,7 +17,7 @@ module AssignTagModerator
add_tag_mod_role(user, tag)
add_trusted_role(user)
add_to_chat_channels(user, tag)
NotifyMailer.tag_moderator_confirmation_email(user, tag.name).deliver unless tag.name == "go"
NotifyMailer.tag_moderator_confirmation_email(user, tag).deliver unless tag.name == "go"
end
end

View file

@ -1,9 +1,13 @@
class ApplicationMailer < ActionMailer::Base
layout "mailer"
# the order of importing the helpers here is important
# we want the application helpers to override the Rails route helpers should there be a name conflict
# an example is the user_url
helper Rails.application.routes.url_helpers
helper ApplicationHelper
default(
from: -> { "DEV Community <#{SiteConfig.default_site_email}>" },
from: -> { "#{ApplicationConfig['COMMUNITY_NAME']} Community <#{SiteConfig.default_site_email}>" },
template_path: ->(mailer) { "mailers/#{mailer.class.name.underscore}" },
)

View file

@ -1,5 +1,5 @@
class DigestMailer < ApplicationMailer
default from: -> { "DEV Digest <#{SiteConfig.default_site_email}>" }
default from: -> { "#{ApplicationConfig['COMMUNITY_NAME']} Digest <#{SiteConfig.default_site_email}>" }
def digest_email(user, articles)
@user = user
@ -25,26 +25,27 @@ class DigestMailer < ApplicationMailer
end
def email_end_phrase
community_name = ApplicationConfig["COMMUNITY_NAME"]
# "more trending DEV posts" won the previous split test
# Included more often as per explore-exploit algorithm
[
"more trending DEV posts",
"more trending DEV posts",
"more trending DEV posts",
"more trending DEV posts",
"more trending DEV posts",
"more trending DEV posts",
"more trending DEV posts",
"more trending DEV posts",
"more trending DEV posts",
"more trending #{community_name} posts",
"more trending #{community_name} posts",
"more trending #{community_name} posts",
"more trending #{community_name} posts",
"more trending #{community_name} posts",
"more trending #{community_name} posts",
"more trending #{community_name} posts",
"more trending #{community_name} posts",
"more trending #{community_name} posts",
"other posts you might like",
"other DEV posts you might like",
"other trending DEV posts",
"other top DEV posts",
"more top DEV posts",
"other #{community_name} posts you might like",
"other trending #{community_name} posts",
"other top #{community_name} posts",
"more top #{community_name} posts",
"more top reads from the community",
"more top DEV posts based on your interests",
"more trending DEV posts picked for you",
"more top #{community_name} posts based on your interests",
"more trending #{community_name} posts picked for you",
].sample
end
end

View file

@ -1,6 +1,6 @@
class NotifyMailer < ApplicationMailer
SUBJECTS = {
new_follower_email: "just followed you on dev.to".freeze
new_follower_email: "just followed you on #{ApplicationConfig['COMMUNITY_NAME']}".freeze
}.freeze
def new_reply_email(comment)
@ -40,7 +40,7 @@ class NotifyMailer < ApplicationMailer
@unread_notifications_count = NotificationCounter.new(@user).unread_notification_count
@unsubscribe = generate_unsubscribe_token(@user.id, :email_unread_notifications)
subject = "🔥 You have #{@unread_notifications_count} unread notifications on dev.to"
subject = "🔥 You have #{@unread_notifications_count} unread notifications on #{ApplicationConfig['COMMUNITY_NAME']}"
mail(to: @user.email, subject: subject)
end
@ -94,14 +94,14 @@ class NotifyMailer < ApplicationMailer
def account_deleted_email(user)
@name = user.name
subject = "dev.to - Account Deletion Confirmation"
subject = "#{ApplicationConfig['COMMUNITY_NAME']} - Account Deletion Confirmation"
mail(to: user.email, subject: subject)
end
def account_deletion_requested_email(user, token)
@name = user.name
@token = token
subject = "dev.to - Account Deletion Requested"
subject = "#{ApplicationConfig['COMMUNITY_NAME']} - Account Deletion Requested"
mail(to: user.email, subject: subject)
end
@ -112,10 +112,10 @@ class NotifyMailer < ApplicationMailer
mail(to: @user.email, subject: "The export of your content is ready")
end
def tag_moderator_confirmation_email(user, tag_name)
@tag_name = tag_name
def tag_moderator_confirmation_email(user, tag)
@tag = tag
@user = user
subject = "Congrats! You're the moderator for ##{tag_name}"
subject = "Congrats! You're the moderator for ##{@tag.name}"
mail(to: @user.email, subject: subject)
end

View file

@ -1,6 +1,6 @@
<% title("#{community_name} Connect 👩‍💻💬👨‍💻") %>
<%= content_for :page_meta do %>
<link rel="canonical" href="<%= app_url("/connect") %>" />
<link rel="canonical" href="<%= app_url(connect_path) %>" />
<meta name="description" content="<%= community_name %> Connect">
<% end %>
<%= csrf_meta_tags %>

View file

@ -6,7 +6,7 @@
<br />
<div class="unsubscribed__message">
Please
<a href="https://dev.to/settings/notifications">sign-in</a>
<a href="<%= app_url(user_settings_path(:notifications)) %>">sign-in</a>
to manage your email preferences.
</div>
</div>

View file

@ -18,10 +18,10 @@
<div style="font-size:0.78em">
<% if @unsubscribe %>
<%= link_to "Unsubscribe", email_subscriptions_unsubscribe_url(ut: @unsubscribe), style: "color:#7d7d7d" %> |
<a href="https://dev.to/settings/notifications" style="color:#7d7d7d">Adjust your email settings</a>
<a href="<%= app_url(user_settings_path(:notifications)) %>" style="color:#7d7d7d">Adjust your email settings</a>
<% else %>
Don't want to get emails like this? Adjust your email settings at
<a href="https://dev.to/settings/notifications">dev.to/settings/notifications</a>
<a href="<%= app_url(user_settings_path(:notifications)) %>"><%= app_url(user_settings_path(:notifications)) %></a>
<% end %>
</div>
</td>

View file

@ -5,7 +5,7 @@
<ul>
<% @articles.each do |article| %>
<li style="margin:18px auto">
<a href="https://dev.to<%= article.path %>" style="font-weight: bold;color:#0045ff;font-size:calc(0.93em + 0.2vw);"><%= article.title.strip %></a> <%= truncate(article.description, length: 120) %>
<a href="<%= article_url(article) %>" style="font-weight: bold;color:#0045ff;font-size:calc(0.93em + 0.2vw);"><%= article.title.strip %></a> <%= truncate(article.description, length: 120) %>
</li>
<% end %>
<hr />
@ -13,9 +13,9 @@
<div>
👋 <b>Looking for work?</b> <a href="https://dev.to/listings/jobs">Browse job openings</a> or create an <a href="https://dev.to/listings/forhire">available for hire</a> listing.
👋 <b>Looking for work?</b> <a href="<%= app_url("/listings/jobs") %>">Browse job openings</a> or create an <a href="<%= app_url("/listings/forhire") %>">available for hire</a> listing.
<br />
🔍 <b>Hiring developers?</b> Post your position(s) on <a href="https://dev.to/page/post-a-job"><%= community_name %> Listings</a>.
🔍 <b>Hiring developers?</b> Post your position(s) on <a href="<%= app_url("/page/post-a-job") %>"><%= community_name %> Listings</a>.
</div>
<center style="margin-top:50px;">
@ -25,7 +25,7 @@
You can now add your coding experience level to your account in order to receive more relevant content.
</b>
<br /><br />
Visit <b><a href="https://dev.to/settings/misc" style="text-decoration: none;">your settings</a></b> to enter your experience level on a scale of 1-10.
Visit <b><a href="<%= app_url(user_settings_path(:misc)) %>" style="text-decoration: none;">your settings</a></b> to enter your experience level on a scale of 1-10.
<br /><br />
You can change it any time in the future. Happy coding!
<% elsif @user.follows.size == 0 %>
@ -34,7 +34,7 @@
</b>
<br /><br />
Your digest is not yet customized. Follow the people and technologies on
<a href="https://dev.to" style="text-decoration: none;"><%= community_name %></a> that interest you in order to receive the most relevant posts in your inbox.
<a href="<%= app_url %>" style="text-decoration: none;"><%= community_name %></a> that interest you in order to receive the most relevant posts in your inbox.
<% else %>
<% tip_rand = rand(5) %>
<% if tip_rand == 0 %>

View file

@ -5,10 +5,10 @@
<% end %>
<h2 style="font-size:32px;">
<a href="https://dev.to/<%= @follower.username %>"><%= @follower.name %></a> just followed you 🤗</h2>
<a href="<%= user_url(@follower) %>"><%= @follower.name %></a> just followed you 🤗</h2>
<h3 style="font-weight:600">You now have <%= pluralize(@user.followers_count, "total follower") %>. See all of your recent followers
<a href="https://dev.to/dashboard/user_followers">right here</a>.</h3>
<a href="<%= app_url("/dashboard/user_followers") %>">right here</a>.</h3>
<p>
When someone follows you on
<a href="https://dev.to"><%= community_name %></a>, your posts will be prioritized in their feed and notifications. The perks of popularity I suppose.
<a href="<%= app_url %>"><%= community_name %></a>, your posts will be prioritized in their feed and notifications. The perks of popularity I suppose.
</p>

View file

@ -1,5 +1,5 @@
<h2 style="font-size:25px;">
<a href="https://dev.to/<%= @mentioner.username %>"><%= @mentioner.name %></a> just mentioned you in their <%= @mention.mentionable_type.downcase %>!
<a href="<%= user_url(@mentioner) %>"><%= @mentioner.name %></a> just mentioned you in their <%= @mention.mentionable_type.downcase %>!
</h2>
<table>
<tr>
@ -10,7 +10,7 @@
<tr>
<td style='padding:20px;padding-bottom:30px;border-radius:3px;font-size:19px;background:#f4f4f4'>
<%= @mentionable.processed_html.html_safe %>
<a style="background:#3c7dc1;color:white;padding:5px 14px;border-radius:3px;text-decoration:none;display:inline-block;margin-top:4px;" href='https://dev.to<%= @mention.mentionable.path %>'>view on <%= community_name %></a>
<a style="background:#3c7dc1;color:white;padding:5px 14px;border-radius:3px;text-decoration:none;display:inline-block;margin-top:4px;" href='<%= app_url(@mention.mentionable.path) %>'>View on <%= community_name %></a>
</td>
</tr>
</table>

View file

@ -1,4 +1,4 @@
<h2 style="font-size:25px;"><%= link_to(@message.user.name, "https://dev.to/#{@message.user.username}") %> sent you a message on <%= community_name %> Connect</h2>
<h2 style="font-size:25px;"><%= link_to(@message.user.name, "#{user_url(@message.user)}") %> sent you a message on <%= community_name %> Connect</h2>
<table>
<tr>
<td style='color:#c3c3c3;font-size:14px;padding-bottom:8px'>
@ -8,11 +8,11 @@
<td style='padding:20px;padding-bottom:30px;border-radius:3px;font-size:19px;background:#f4f4f4'>
<%= @message.message_html.html_safe %>
<br /><br />
<a style="background:#3c7dc1;color:white;padding:5px 14px;border-radius:3px;text-decoration:none;display:inline-block;margin-top:4px;" href='https://dev.to/connect/@<%= @message.user.username %>'>view on <%= community_name %></a>
<a style="background:#3c7dc1;color:white;padding:5px 14px;border-radius:3px;text-decoration:none;display:inline-block;margin-top:4px;" href='<%= app_url("/connect/@#{@message.user.username}") %>'>View on <%= community_name %></a>
</td>
</tr>
</table>
<br />
<em>You only get emails like this if you have not been active on
<a href="https://dev.to/connect">dev.to/connect</a> in the past day. You may disable this type of email in your settings.</em>
<a href="<%= app_url(connect_path) %>"><%= community_name %> Connect</a> in the past day. You may disable this type of email in your settings.</em>

View file

@ -1,3 +1,3 @@
<%= ActionController::Base.helpers.strip_tags(@message.message_html.html_safe) %>
View now: https://dev.to/connect/@<%= @message.user.username %>
View now: <%= app_url("/connect/@#{@message.user.username}") %>

View file

@ -1,4 +1,4 @@
<h2 style="font-size:25px;"><%= link_to(@comment.user.name, "https://dev.to/#{@comment.user.username}") %> replied to you on <%= community_name %></h2>
<h2 style="font-size:25px;"><%= link_to(@comment.user.name, "#{user_url(@comment.user)}/#{}") %> replied to you on <%= community_name %></h2>
<table>
<tr>
<td style='color:#c3c3c3;font-size:14px;padding-bottom:8px'>
@ -11,9 +11,9 @@
<td style='padding:20px;padding-bottom:30px;border-radius:3px;font-size:19px;background:#f4f4f4'>
<h2 style="font-size:22px;color:rgb(107, 107, 107)">re: <em><%= @comment.commentable&.title || "Content No Longer Available" %></em></h2>
<%= @comment.processed_html.html_safe %>
<a style="background:#3c7dc1;color:white;padding:5px 14px;border-radius:3px;text-decoration:none;display:inline-block;margin-top:4px;" href='https://dev.to<%= @comment.path %>'>view on <%= community_name %></a>&nbsp;
<a style="background:#3c7dc1;color:white;padding:5px 14px;border-radius:3px;text-decoration:none;display:inline-block;margin-top:4px;" href='<%= comment_url(@comment) %>'>View on <%= community_name %></a>&nbsp;
<% if @comment.commentable %>
<a style="background:#1f1f1f;color:white;padding:5px 14px;border-radius:3px;text-decoration:none;display:inline-block;margin-top:4px;" href='https://dev.to<%= @comment.commentable.path %>'>read original post</a>
<a style="background:#1f1f1f;color:white;padding:5px 14px;border-radius:3px;text-decoration:none;display:inline-block;margin-top:4px;" href='<%= app_url(@comment.commentable.path) %>'>Read original post</a>
<% end %>
</td>
</tr>

View file

@ -2,4 +2,4 @@
<%= ActionController::Base.helpers.strip_tags(@comment.processed_html.html_safe) %>
View now: https://dev.to<%= @comment.path %>
View now: <%= comment_url(@comment) %>

View file

@ -3,7 +3,7 @@
</p>
<p>
Thanks for volunteering to be a <%= community_name %> tag moderator. Weve added you as a moderator for
<a href="https://dev.to/t/<%= @tag_name %>"><%= @tag_name %></a>. Youre currently the only non-core <%= community_name %> member thats moderating this tag. Over time, well add additional mods to join you because we view moderation as a collaborative endeavor that benefits from the support of multiple people.
<a href="<%= tag_url(@tag) %>"><%= @tag.name %></a>. Youre currently the only non-core <%= community_name %> member thats moderating this tag. Over time, well add additional mods to join you because we view moderation as a collaborative endeavor that benefits from the support of multiple people.
</p>
<p>
As a tag moderator, you are now able to:
@ -17,10 +17,10 @@
</li>
</ul>
<p><strong>For details on how to access these features, visit our
<a href="https://dev.to/tag-moderation">tag moderation</a> page.</strong></p>
<a href="<%= app_url("/tag-moderation") %>">tag moderation</a> page.</strong></p>
<p>
To aid in communication, weve added you to a tag moderator
<a href="https://dev.to/connect/tag-moderators"><%= community_name %> Connect channel</a>. You can use this channel to meet other tag moderators across site, and to coordinate with the <%= community_name %> team. When in doubt about how to exercise your new privileges, please ask!
<a href="<%= app_url("/connect/tag-moderators") %>"><%= community_name %> Connect channel</a>. You can use this channel to meet other tag moderators across site, and to coordinate with the <%= community_name %> team. When in doubt about how to exercise your new privileges, please ask!
</p>
<p>
Tag moderation is still very much in beta, so well be making adjustments and expanding features over time as we receive feedback.

View file

@ -2,16 +2,16 @@
Hey <%= @user.name %>!
</p>
<p>
This is an email to let you know that we've upgraded your account to have <b>basic moderation privileges</b>. This means you can apply "negative reactions" to posts as well as certain other actions which help us maintain a constructive community and uphold our <a href="https://dev.to/code-of-conduct">code of conduct</a>.
This is an email to let you know that we've upgraded your account to have <b>basic moderation privileges</b>. This means you can apply "negative reactions" to posts as well as certain other actions which help us maintain a constructive community and uphold our <a href="<%= app_url(code_of_conduct_path) %>">code of conduct</a>.
</p>
<p>
There are no specific responsibilities with this new privilege except that you use it respectfully and empathetically. If for any reason you'd like to forego these new features, let us know.
</p>
<p>
You'll occasionally get on-site notifications asking you to take an action. You are never required to take any actions and feel free to unsubscribe in <a href="https://dev.to/settings/notifications">your notification settings</a> at any point without giving up the rest of the features.
You'll occasionally get on-site notifications asking you to take an action. You are never required to take any actions and feel free to unsubscribe in <a href="<%= app_url(user_settings_path(:notifications)) %>">your notification settings</a> at any point without giving up the rest of the features.
</p>
<p>
<b><a href="https://dev.to/community-moderation">Click here for full details about basic mod privileges.</b></a>
<b><a href="<%= app_url("/community-moderation") %>">Click here for full details about basic mod privileges.</b></a>
</p>
<p>
Happy Coding!

View file

@ -6,7 +6,7 @@ There are no specific responsibilities with this new privilege except that you u
You'll occasionally get on-site notifications asking you to take an action. You are never required to take any actions and feel free to unsubscribe in your notification settings at any point without giving up the rest of the features.
Visit https://dev.to/community-moderation for full details of what you can do with these new privileges.
Visit <%= app_url("/community-moderation") %> for full details of what you can do with these new privileges.
Happy Coding!

View file

@ -1,4 +1,4 @@
<h3 style="font-weight:300">You're popular!</h3>
<p>
<a style="background:#3c7dc1;color:white;padding:5px 14px;border-radius:3px;text-decoration:none;display:inline-block;margin-top:4px;font-size:33px;" href='https://dev.to/notifications'>Read my notifications</a>
<a style="background:#3c7dc1;color:white;padding:5px 14px;border-radius:3px;text-decoration:none;display:inline-block;margin-top:4px;font-size:33px;" href='<%= app_url("/notifications") %>'>Read my notifications</a>
</p>

View file

@ -1 +1 @@
Visit https://dev.to/notifications to read all of your notifications
Visit <%= app_url(notifications_path) %> to read all of your notifications

View file

@ -3,5 +3,5 @@
</p>
<h2>
🎥 <a href="https://dev.to<%= @article.path %>/edit">Finalize and publish your video</a> 😊
🎥 <a href="<%= article_url(@article) %>/edit">Finalize and publish your video</a> 😊
</h2>

View file

@ -1,3 +1,3 @@
Your video is finished being processed. Check it out here:
https://dev.to<%= @article.path %>/edit
<%= article_url(@article) %>/edit

View file

@ -76,7 +76,7 @@
<p>
Users agree and certify that they have rights to share all content that they post on dev.to — including, but not limited to, information posted in articles, discussions, and comments. This rule applies to prose, code snippets, collections of links, etc. Regardless of citation, users may not post copy and pasted content that does not belong to them. Users assume all risk for the content they post, including someone else's reliance on its accuracy, claims relating to intellectual property, or other legal rights. If you believe that a user has plagiarized content, misrepresented their identity, misappropriated work, or otherwise run afoul of DMCA regulations, please email
<a href="mailto:yo@dev.to">yo@dev.to</a>. <%= community_name %> may remove any content users post for any reason.
<a href="mailto:<%= SiteConfig.default_site_email %>"><%= SiteConfig.default_site_email %></a>. <%= community_name %> may remove any content users post for any reason.
</p>
<h3 id="site-terms-of-use-modifications">
@ -92,7 +92,7 @@
</h3>
<p>
All uses of the <%= community_name %> logo, <%= community_name %> badges, brand slogans, iconography, and the like, may only be used with express permission from <%= community_name %>. <%= community_name %> reserves all rights, even if certain assets are included in <%= community_name %> open source projects. Please contact yo@dev.to with any questions or to request permission.
All uses of the <%= community_name %> logo, <%= community_name %> badges, brand slogans, iconography, and the like, may only be used with express permission from <%= community_name %>. <%= community_name %> reserves all rights, even if certain assets are included in <%= community_name %> open source projects. Please contact <a href="mailto:<%= SiteConfig.default_site_email %>"><%= SiteConfig.default_site_email %></a> with any questions or to request permission.
</p>
<h3 id="reserved-names">

View file

@ -1,11 +1,11 @@
<% title "#{community_qualified_name} Code of Conduct" %>
<%= content_for :page_meta do %>
<link rel="canonical" href="<%= app_url("/code-of-conduct") %>" />
<link rel="canonical" href="<%= app_url(code_of_conduct_path) %>" />
<meta name="description" content="<%= community_qualified_name %> Code of Conduct">
<meta name="keywords" content="software development,engineering,rails,javascript,ruby">
<meta property="og:type" content="article" />
<meta property="og:url" content="<%= app_url("/code-of-conduct") %>" />
<meta property="og:url" content="<%= app_url(code_of_conduct_path) %>" />
<meta property="og:title" content="<%= community_qualified_name %> Code of Conduct" />
<meta property="og:site_name" content="<%= community_qualified_name %>" />
<meta name="twitter:card" content="summary_large_image">

View file

@ -2,7 +2,7 @@
<%= content_for :page_meta do %>
<link rel="canonical" href="<%= app_url("/p/editor_guide") %>" />
<meta name="description" content="dev.to | editor guideline">
<meta name="description" content="<%= community_name %> | editor guideline">
<meta name="keywords" content="software development,engineering,rails,javascript,ruby">
<% end %>

View file

@ -15,7 +15,7 @@ RSpec.describe FeedbackMessagesHelper, type: :helper do
describe "#affected_email_details" do
it "have proper subject and body" do
expect(helper.affected_email_details).to include(subject: "Courtesy Notice from DEV", body: a_string_starting_with("Hi"))
expect(helper.affected_email_details).to include(subject: "Courtesy Notice from #{ApplicationConfig['COMMUNITY_NAME']}", body: a_string_starting_with("Hi"))
end
end
end

View file

@ -15,7 +15,7 @@ RSpec.describe DigestMailer, type: :mailer do
expect(email.subject).not_to be_nil
expect(email.to).to eq([user.email])
expect(email.from).to eq([SiteConfig.default_site_email])
expect(email["from"].value).to eq("DEV Digest <#{SiteConfig.default_site_email}>")
expect(email["from"].value).to eq("#{ApplicationConfig["COMMUNITY_NAME"]} Digest <#{SiteConfig.default_site_email}>")
end
it "includes the tracking pixel" do

View file

@ -16,7 +16,7 @@ RSpec.describe NotifyMailer, type: :mailer do
it "renders proper sender" do
expect(email.from).to eq([SiteConfig.default_site_email])
expect(email["from"].value).to eq("DEV Community <#{SiteConfig.default_site_email}>")
expect(email["from"].value).to eq("#{ApplicationConfig["COMMUNITY_NAME"]} Community <#{SiteConfig.default_site_email}>")
end
it "renders proper receiver" do
@ -40,12 +40,12 @@ RSpec.describe NotifyMailer, type: :mailer do
before { user2.follow(user) }
it "renders proper subject" do
expect(email.subject).to eq("#{user2.name} just followed you on dev.to")
expect(email.subject).to eq("#{user2.name} just followed you on #{ApplicationConfig["COMMUNITY_NAME"]}")
end
it "renders proper sender" do
expect(email.from).to eq([SiteConfig.default_site_email])
expect(email["from"].value).to eq("DEV Community <#{SiteConfig.default_site_email}>")
expect(email["from"].value).to eq("#{ApplicationConfig["COMMUNITY_NAME"]} Community <#{SiteConfig.default_site_email}>")
end
it "renders proper receiver" do
@ -73,7 +73,7 @@ RSpec.describe NotifyMailer, type: :mailer do
it "renders proper sender" do
expect(email.from).to eq([SiteConfig.default_site_email])
expect(email["from"].value).to eq("DEV Community <#{SiteConfig.default_site_email}>")
expect(email["from"].value).to eq("#{ApplicationConfig["COMMUNITY_NAME"]} Community <#{SiteConfig.default_site_email}>")
end
it "renders proper receiver" do
@ -95,12 +95,12 @@ RSpec.describe NotifyMailer, type: :mailer do
let(:email) { described_class.unread_notifications_email(user) }
it "renders proper subject" do
expect(email.subject).to eq("🔥 You have 0 unread notifications on dev.to")
expect(email.subject).to eq("🔥 You have 0 unread notifications on #{ApplicationConfig["COMMUNITY_NAME"]}")
end
it "renders proper sender" do
expect(email.from).to eq([SiteConfig.default_site_email])
expect(email["from"].value).to eq("DEV Community <#{SiteConfig.default_site_email}>")
expect(email["from"].value).to eq("#{ApplicationConfig["COMMUNITY_NAME"]} Community <#{SiteConfig.default_site_email}>")
end
it "renders proper receiver" do
@ -127,7 +127,7 @@ RSpec.describe NotifyMailer, type: :mailer do
it "renders proper sender" do
expect(email.from).to eq([SiteConfig.default_site_email])
expect(email["from"].value).to eq("DEV Community <#{SiteConfig.default_site_email}>")
expect(email["from"].value).to eq("#{ApplicationConfig["COMMUNITY_NAME"]} Community <#{SiteConfig.default_site_email}>")
end
it "renders proper receiver" do
@ -165,7 +165,7 @@ RSpec.describe NotifyMailer, type: :mailer do
it "renders proper sender" do
expect(email.from).to eq([SiteConfig.default_site_email])
expect(email["from"].value).to eq("DEV Community <#{SiteConfig.default_site_email}>")
expect(email["from"].value).to eq("#{ApplicationConfig["COMMUNITY_NAME"]} Community <#{SiteConfig.default_site_email}>")
end
it "renders proper receiver" do
@ -262,7 +262,7 @@ RSpec.describe NotifyMailer, type: :mailer do
let(:email_params) do
{
email_to: user.email,
email_subject: "DEV Report Status Update",
email_subject: "#{ApplicationConfig["COMMUNITY_NAME"]} Report Status Update",
email_body: "You've violated our code of conduct",
email_type: "Reporter",
feedback_message_id: feedback_message.id
@ -271,12 +271,12 @@ RSpec.describe NotifyMailer, type: :mailer do
let(:email) { described_class.feedback_message_resolution_email(email_params) }
it "renders proper subject" do
expect(email.subject).to eq("DEV Report Status Update")
expect(email.subject).to eq("#{ApplicationConfig["COMMUNITY_NAME"]} Report Status Update")
end
it "renders proper sender" do
expect(email.from).to eq([SiteConfig.default_site_email])
expect(email["from"].value).to eq("DEV Community <#{SiteConfig.default_site_email}>")
expect(email["from"].value).to eq("#{ApplicationConfig["COMMUNITY_NAME"]} Community <#{SiteConfig.default_site_email}>")
end
it "renders proper receiver" do
@ -318,7 +318,7 @@ RSpec.describe NotifyMailer, type: :mailer do
it "renders proper sender" do
expect(email.from).to eq([SiteConfig.default_site_email])
expect(email["from"].value).to eq("DEV Community <#{SiteConfig.default_site_email}>")
expect(email["from"].value).to eq("#{ApplicationConfig["COMMUNITY_NAME"]} Community <#{SiteConfig.default_site_email}>")
end
it "renders proper receiver" do
@ -345,7 +345,7 @@ RSpec.describe NotifyMailer, type: :mailer do
it "renders proper sender" do
expect(email.from).to eq([SiteConfig.default_site_email])
expect(email["from"].value).to eq("DEV Community <#{SiteConfig.default_site_email}>")
expect(email["from"].value).to eq("#{ApplicationConfig["COMMUNITY_NAME"]} Community <#{SiteConfig.default_site_email}>")
end
it "renders proper receiver" do
@ -367,12 +367,12 @@ RSpec.describe NotifyMailer, type: :mailer do
let(:email) { described_class.account_deleted_email(user) }
it "renders proper subject" do
expect(email.subject).to eq("dev.to - Account Deletion Confirmation")
expect(email.subject).to eq("#{ApplicationConfig["COMMUNITY_NAME"]} - Account Deletion Confirmation")
end
it "renders proper sender" do
expect(email.from).to eq([SiteConfig.default_site_email])
expect(email["from"].value).to eq("DEV Community <#{SiteConfig.default_site_email}>")
expect(email["from"].value).to eq("#{ApplicationConfig["COMMUNITY_NAME"]} Community <#{SiteConfig.default_site_email}>")
end
it "renders proper receiver" do
@ -399,7 +399,7 @@ RSpec.describe NotifyMailer, type: :mailer do
it "renders proper sender" do
expect(email.from).to eq([SiteConfig.default_site_email])
expect(email["from"].value).to eq("DEV Community <#{SiteConfig.default_site_email}>")
expect(email["from"].value).to eq("#{ApplicationConfig["COMMUNITY_NAME"]} Community <#{SiteConfig.default_site_email}>")
end
it "renders proper receiver" do
@ -428,7 +428,7 @@ RSpec.describe NotifyMailer, type: :mailer do
describe "#tag_moderator_confirmation_email" do
let(:tag) { create(:tag) }
let(:email) { described_class.tag_moderator_confirmation_email(user, tag.name) }
let(:email) { described_class.tag_moderator_confirmation_email(user, tag) }
it "renders proper subject" do
expect(email.subject).to eq("Congrats! You're the moderator for ##{tag.name}")
@ -436,7 +436,7 @@ RSpec.describe NotifyMailer, type: :mailer do
it "renders proper sender" do
expect(email.from).to eq([SiteConfig.default_site_email])
expect(email["from"].value).to eq("DEV Community <#{SiteConfig.default_site_email}>")
expect(email["from"].value).to eq("#{ApplicationConfig["COMMUNITY_NAME"]} Community <#{SiteConfig.default_site_email}>")
end
it "renders proper receiver" do
@ -464,7 +464,7 @@ RSpec.describe NotifyMailer, type: :mailer do
it "renders proper sender" do
expect(email.from).to eq([SiteConfig.default_site_email])
expect(email["from"].value).to eq("DEV Community <#{SiteConfig.default_site_email}>")
expect(email["from"].value).to eq("#{ApplicationConfig["COMMUNITY_NAME"]} Community <#{SiteConfig.default_site_email}>")
end
it "renders proper receiver" do
@ -495,9 +495,9 @@ RSpec.describe NotifyMailer, type: :mailer do
it "renders proper sender" do
expect(moderator_email.from).to eq([SiteConfig.default_site_email])
expect(moderator_email["from"].value).to eq("DEV Community <#{SiteConfig.default_site_email}>")
expect(moderator_email["from"].value).to eq("#{ApplicationConfig["COMMUNITY_NAME"]} Community <#{SiteConfig.default_site_email}>")
expect(member_email.from).to eq([SiteConfig.default_site_email])
expect(member_email["from"].value).to eq("DEV Community <#{SiteConfig.default_site_email}>")
expect(member_email["from"].value).to eq("#{ApplicationConfig["COMMUNITY_NAME"]} Community <#{SiteConfig.default_site_email}>")
end
it "renders proper receiver" do

View file

@ -39,7 +39,7 @@ class NotifyMailerPreview < ActionMailer::Preview
end
def tag_moderator_confirmation_email
NotifyMailer.tag_moderator_confirmation_email(User.first, "discuss")
NotifyMailer.tag_moderator_confirmation_email(User.first, Tag.find(1))
end
def trusted_role_email
@ -62,7 +62,7 @@ class NotifyMailerPreview < ActionMailer::Preview
HEREDOC
params = {
email_to: @user.email,
email_subject: "Courtesy notice from dev.to",
email_subject: "Courtesy notice from #{ApplicationConfig['COMMUNITY_NAME']}",
email_body: email_body,
email_type: "Reporter",
feedback_message_id: rand(100)

View file

@ -36,7 +36,7 @@ RSpec.describe Follows::SendEmailNotificationWorker, type: :worker do
end
it "doesn't create an EmailMessage if it already exists" do
subject = "#{user.username} just followed you on dev.to"
subject = "#{user.username} just followed you on #{ApplicationConfig['COMMUNITY_NAME']}"
EmailMessage.create!(user_id: user2.id, sent_at: Time.current, subject: subject)
worker.drain