FIX: Use `post_count` instead of `topic_reply_count` in education for replies.
This commit is contained in:
parent
09b640b782
commit
b39d39dbb6
|
@ -17,7 +17,7 @@ class ComposerMessagesFinder
|
||||||
count = @user.created_topic_count
|
count = @user.created_topic_count
|
||||||
education_key = :education_new_topic
|
education_key = :education_new_topic
|
||||||
else
|
else
|
||||||
count = @user.topic_reply_count
|
count = @user.post_count
|
||||||
education_key = :education_new_reply
|
education_key = :education_new_reply
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -59,8 +59,8 @@ class ComposerMessagesFinder
|
||||||
# For users who are not new
|
# For users who are not new
|
||||||
@user.has_trust_level?(:basic) &&
|
@user.has_trust_level?(:basic) &&
|
||||||
|
|
||||||
# And who have posted enough topics
|
# And who have posted enough
|
||||||
(@user.topic_reply_count > SiteSetting.educate_until_posts) &&
|
(@user.post_count > SiteSetting.educate_until_posts) &&
|
||||||
|
|
||||||
# And who haven't been notified about sequential replies already
|
# And who haven't been notified about sequential replies already
|
||||||
(!UserHistory.exists_for_user?(@user, :notified_about_sequential_replies))
|
(!UserHistory.exists_for_user?(@user, :notified_about_sequential_replies))
|
||||||
|
|
|
@ -46,12 +46,12 @@ describe ComposerMessagesFinder do
|
||||||
end
|
end
|
||||||
|
|
||||||
it "returns a message for a user who has not posted any topics" do
|
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
|
finder.check_education_message.should be_present
|
||||||
end
|
end
|
||||||
|
|
||||||
it "returns no message when the user has posted enough topics" do
|
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
|
finder.check_education_message.should be_blank
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -109,7 +109,7 @@ describe ComposerMessagesFinder do
|
||||||
|
|
||||||
before do
|
before do
|
||||||
SiteSetting.stubs(:educate_until_posts).returns(10)
|
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)
|
||||||
Fabricate(:post, topic: topic, user: user)
|
Fabricate(:post, topic: topic, user: user)
|
||||||
|
@ -135,7 +135,7 @@ describe ComposerMessagesFinder do
|
||||||
end
|
end
|
||||||
|
|
||||||
it "does not give a message to users who are still in the 'education' phase" do
|
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
|
finder.check_sequential_replies.should be_blank
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue