Modify digest email copy and add rescue (#161)

* Modify digest email copy

* Rescue failure in digest email
This commit is contained in:
Ben Halpern 2018-03-29 17:10:25 -04:00 committed by GitHub
parent ac9713b4ce
commit c8ae0d08c3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 30 additions and 18 deletions

View file

@ -18,6 +18,8 @@ class EmailDigest
next unless user_email_heuristic.should_receive_email?
articles = user_email_heuristic.articles_to_send
DigestMailer.digest_email(user, articles).deliver
rescue
puts "Email issue"
end
end

View file

@ -186,28 +186,38 @@
<% @articles.each do |article| %>
<ul>
<li>
<a href="https://dev.to<%= article.path %>" style="font-weight: bold;color:#0045ff"><%= article.title %></a> <%= truncate(article.description, length: 80) %>
<a href="https://dev.to<%= article.path %>" style="font-weight: bold;color:#0045ff;font-size:1.06em;"><%= article.title.strip %></a> <%= truncate(article.description, length: 80) %>
</li>
</ul>
<% end %>
<% 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!
<center style="margin-top:50px;">
<em>
<% if @user.follows.size == 0 %>
<b>
DEV Digest is a new periodic email featuring the best posts from our community of <%= User.all.size %> developers.
</b>
<br/><br/>
Your digest is not yet customized. Follow the people and technologies on <a href="https://dev.to" style="text-decoration: none;">dev.to</a> that interest you in order to receive the most relevant posts in your inbox.
<% else %>
Can't wait to see <b>your</b> first DEV post!
<% tip_rand = rand(5) %>
<% 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 %>
<% end %>
<% end %>
</em></center>
</em>
</center>
<% end %>