FIX: digest popular posts need minimum datetime

This commit is contained in:
Neil Lalonde 2016-11-18 16:57:23 -05:00
parent 45f368126f
commit 1183e582c3

View File

@ -108,7 +108,7 @@ class UserNotifications < ActionMailer::Base
topics_for_digest = Topic.for_digest(user, min_date, limit: SiteSetting.digest_topics + 3, top_order: true).to_a
@popular_topics = topics_for_digest[0,SiteSetting.digest_topics]
@popular_posts = SiteSetting.digest_posts > 0 ? Post.where("post_number > ?", 1).where("score > ?", 5.0).order("score DESC").limit(SiteSetting.digest_posts) : []
@popular_posts = SiteSetting.digest_posts > 0 ? Post.where("post_number > ? AND score > ? AND created_at > ?", 1, 5.0, min_date).order("score DESC").limit(SiteSetting.digest_posts) : []
@other_new_for_you = topics_for_digest.size > SiteSetting.digest_topics ? topics_for_digest[SiteSetting.digest_topics..-1] : []
topic_lookup = TopicUser.lookup_for(user, @other_new_for_you)