From b39d39dbb675476801652ce3a5855b5c39859cea Mon Sep 17 00:00:00 2001 From: Robin Ward Date: Sat, 14 Sep 2013 00:32:18 -0400 Subject: [PATCH] FIX: Use `post_count` instead of `topic_reply_count` in education for replies. --- lib/composer_messages_finder.rb | 6 +++--- spec/components/composer_messages_finder_spec.rb | 8 ++++---- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/lib/composer_messages_finder.rb b/lib/composer_messages_finder.rb index f05fa862698..983081a3aa2 100644 --- a/lib/composer_messages_finder.rb +++ b/lib/composer_messages_finder.rb @@ -17,7 +17,7 @@ class ComposerMessagesFinder count = @user.created_topic_count education_key = :education_new_topic else - count = @user.topic_reply_count + count = @user.post_count education_key = :education_new_reply end @@ -59,8 +59,8 @@ class ComposerMessagesFinder # For users who are not new @user.has_trust_level?(:basic) && - # And who have posted enough topics - (@user.topic_reply_count > SiteSetting.educate_until_posts) && + # And who have posted enough + (@user.post_count > SiteSetting.educate_until_posts) && # And who haven't been notified about sequential replies already (!UserHistory.exists_for_user?(@user, :notified_about_sequential_replies)) diff --git a/spec/components/composer_messages_finder_spec.rb b/spec/components/composer_messages_finder_spec.rb index 35e16b318d7..4945168e6c0 100644 --- a/spec/components/composer_messages_finder_spec.rb +++ b/spec/components/composer_messages_finder_spec.rb @@ -46,12 +46,12 @@ describe ComposerMessagesFinder do end it "returns a message for a user who has not posted any topics" do - user.expects(:topic_reply_count).returns(10) + user.expects(:post_count).returns(10) finder.check_education_message.should be_present end it "returns no message when the user has posted enough topics" do - user.expects(:topic_reply_count).returns(11) + user.expects(:post_count).returns(11) finder.check_education_message.should be_blank end end @@ -109,7 +109,7 @@ describe ComposerMessagesFinder do before do SiteSetting.stubs(:educate_until_posts).returns(10) - user.topic_reply_count = 11 + user.stubs(:post_count).returns(11) Fabricate(:post, topic: topic, user: user) Fabricate(:post, topic: topic, user: user) @@ -135,7 +135,7 @@ describe ComposerMessagesFinder do end it "does not give a message to users who are still in the 'education' phase" do - user.topic_reply_count = 10 + user.stubs(:post_count).returns(10) finder.check_sequential_replies.should be_blank end