Include a list of more new topics in the digest emails at the bottom

This commit is contained in:
Robin Ward
2013-08-09 14:43:02 -04:00
parent 730f57a751
commit 652169daf6
6 changed files with 22 additions and 7 deletions
+5 -3
View File
@@ -39,11 +39,13 @@ class UserNotifications < ActionMailer::Base
@last_seen_at = I18n.l(@user.last_seen_at || @user.created_at, format: :short)
# A list of topics to show the user
@new_topics = Topic.for_digest(user, min_date)
@markdown_linker = MarkdownLinker.new(Discourse.base_url)
@featured_topics = Topic.for_digest(user, min_date).to_a
# Don't send email unless there is content in it
if @new_topics.present?
if @featured_topics.present?
@featured_topics, @new_topics = @featured_topics[0..4], @featured_topics[5..-1]
@markdown_linker = MarkdownLinker.new(Discourse.base_url)
build_email user.email,
from_alias: I18n.t('user_notifications.digest.from', site_name: SiteSetting.title),
subject: I18n.t('user_notifications.digest.subject_template',
+1 -1
View File
@@ -200,7 +200,7 @@ class Topic < ActiveRecord::Base
.created_since(since)
.listable_topics
.order(:percent_rank)
.limit(5)
.limit(100)
end
def update_meta_data(data)
+1 -1
View File
@@ -2,7 +2,7 @@
<tr>
<td style="padding: 10px 10px; background-color: #eee; border: 1px solid #ddd;">
<a href="<%= Discourse.base_url %>">
<img src="<%= logo_url %>" style="height: 35px"></a>
<img src="<%= logo_url %>" style="max-height: 35px; min-height: 35px; height: 35px;"></a>
</td>
</tr>
<tr>
+13 -2
View File
@@ -3,10 +3,10 @@
site_link: site_link,
last_seen_at: @last_seen_at) %>
<%- if @new_topics.present? %>
<%- if @featured_topics.present? %>
### <%=t 'user_notifications.digest.top_topics' %>
<%- @new_topics.each do |t| %>
<%- @featured_topics.each do |t| %>
<%= raw(@markdown_linker.create(t.title, t.relative_url)) %>
<%- if t.best_post.present? %>
@@ -22,6 +22,17 @@
<%- end %>
<%- end %>
<%- if @new_topics.present? %>
**<%=t 'user_notifications.digest.other_new_topics' %>**
<%- @new_topics.each do |t| %>
* <%= raw(@markdown_linker.create(t.title, t.relative_url)) %> <%- if t.category %>[<%= t.category.name %>]<%- end %>
<%- end -%>
<%- end -%>
<%= raw(@markdown_linker.references) %>
<%=raw(t :'user_notifications.digest.unsubscribe',