Adjust email digest copy and subject (#160)

* Adjust email copy in digest

* Adjust email digest subject
This commit is contained in:
Ben Halpern 2018-03-28 18:14:55 -04:00 committed by GitHub
parent ca9ff7b1b8
commit ac9713b4ce
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 28 additions and 4 deletions

View file

@ -7,13 +7,19 @@ class DigestMailer < ApplicationMailer
end
@articles = articles.first(6)
@digest_email = true
mail(from: "DEV Digest <yo@dev.to>", to: @user.email, subject: "#{@articles.first.title} #{random_emoji} and #{@articles.size - 1} #{email_end_phrase}") do |format|
mail(from: "DEV Digest <yo@dev.to>", to: @user.email, subject: "#{adjusted_title(@articles.first)} + #{@articles.size - 1} #{email_end_phrase} #{random_emoji}") do |format|
format.html { render "layouts/mailer" }
end
end
def adjusted_title(article)
title = article.title.strip
title = "\"#{title}\"" unless title.start_with? '"'
end
def random_emoji
["📖","🎉","🙈","🔥","💬","👋","👏","🐶","🦁","🦊","🐙","🦄","❤️"].shuffle.take(3).join
["🤓","🎉","🙈","🔥","💬","👋","👏","🐶","🦁","🦊","🐙","🦄","❤️","😇"].shuffle.take(3).join
end
def email_end_phrase

View file

@ -182,7 +182,7 @@
<h1 style="text-align: center;">
DEV Digest
</h1>
<h4 style="text-align: center;">Recent posts you might find valuable based on who you follow ❤️</h4>
<h4 style="text-align: center;">Recent posts you might find valuable based on your interests ❤️</h4>
<% @articles.each do |article| %>
<ul>
<li>
@ -191,5 +191,23 @@
</ul>
<% end %>
<center style="margin-top:50px;"><em>Thanks for being a valued member of the community.</em> 👩‍💻👨‍💻</center>
<% tip_rand = rand(5) %>
<center style="margin-top:50px;"><em>
<% if tip_rand == 0 %>
Thanks for being a valued member of the community.
<% elsif tip_rand == 1 %>
Follow the authors you want to see more of!
<% elsif tip_rand == 2 %>
And there's so much more dev goodness to discover.
<% elsif tip_rand == 3 %>
You're a better dev today than you were yesterday.
<% elsif tip_rand == 4 %>
<% if @user.articles.where(published: true).any? %>
Can't wait to see <b>your</b> next DEV post!
<% else %>
Can't wait to see <b>your</b> first DEV post!
<% end %>
<% end %>
</em></center>
<% end %>