From 4eb5474858ab5cda8609afc9d7d0ef44d07085b0 Mon Sep 17 00:00:00 2001 From: Robin Ward Date: Mon, 21 Apr 2014 14:44:00 -0400 Subject: [PATCH] Add a SiteSetting to configure how many topics are in the email digest. --- app/mailers/user_notifications.rb | 2 +- config/locales/server.en.yml | 1 + config/site_settings.yml | 1 + 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/app/mailers/user_notifications.rb b/app/mailers/user_notifications.rb index 0f992b8ed..2cd39794a 100644 --- a/app/mailers/user_notifications.rb +++ b/app/mailers/user_notifications.rb @@ -42,7 +42,7 @@ 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 - @featured_topics = Topic.for_digest(user, min_date, limit: 20, top_order: true).to_a + @featured_topics = Topic.for_digest(user, min_date, limit: SiteSetting.digest_topics, top_order: true).to_a # Don't send email unless there is content in it if @featured_topics.present? diff --git a/config/locales/server.en.yml b/config/locales/server.en.yml index c2af6e682..db7c4114c 100644 --- a/config/locales/server.en.yml +++ b/config/locales/server.en.yml @@ -838,6 +838,7 @@ en: allow_uploaded_avatars: "Allow users to upload their custom avatars" allow_animated_avatars: "Allow users to use animated gif for avatars. WARNING: it is highly recommended to run the avatars:regenerate rake task after changing that setting." + digest_topics: "The maximum amount of topics to display in an email digest" digest_min_excerpt_length: "How many characters we're aiming for for each post in the email digest" default_digest_email_frequency: "How often users receive digest emails by default. They can change this setting in their preferences." default_external_links_in_new_tab: "Open external links in a new tab. Users can change this in their preferences." diff --git a/config/site_settings.yml b/config/site_settings.yml index f32b740ec..fd08b32a6 100644 --- a/config/site_settings.yml +++ b/config/site_settings.yml @@ -253,6 +253,7 @@ email: email_time_window_mins: 10 email_posts_context: 5 digest_min_excerpt_length: 100 + digest_topics: 20 default_digest_email_frequency: default: 7 enum: 'DigestEmailSiteSetting'