FIX: popular posts in digest need to use same restrictions as topics

This commit is contained in:
Neil Lalonde 2016-11-23 11:24:06 -05:00
parent 91c21dad28
commit 79dc0518c9
2 changed files with 4 additions and 4 deletions

View File

@ -111,8 +111,8 @@ class UserNotifications < ActionMailer::Base
@other_new_for_you = topics_for_digest.size > SiteSetting.digest_topics ? topics_for_digest[SiteSetting.digest_topics..-1] : [] @other_new_for_you = topics_for_digest.size > SiteSetting.digest_topics ? topics_for_digest[SiteSetting.digest_topics..-1] : []
@popular_posts = if SiteSetting.digest_posts > 0 @popular_posts = if SiteSetting.digest_posts > 0
Post.public_posts Post.for_mailing_list(user, min_date)
.where("posts.post_number > ? AND posts.score > ? AND posts.created_at > ?", 1, 5.0, min_date) .where("posts.post_number > ? AND posts.score > ?", 1, 5.0)
.order("posts.score DESC") .order("posts.score DESC")
.limit(SiteSetting.digest_posts) .limit(SiteSetting.digest_posts)
else else

View File

@ -155,8 +155,8 @@ describe UserNotifications do
context "with new topics" do context "with new topics" do
before do before do
Topic.expects(:for_digest).returns([Fabricate(:topic, user: Fabricate(:coding_horror))]) Topic.stubs(:for_digest).returns([Fabricate(:topic, user: Fabricate(:coding_horror))])
Topic.expects(:new_since_last_seen).returns(Topic.none) Topic.stubs(:new_since_last_seen).returns(Topic.none)
end end
it "works" do it "works" do