mirror of
https://github.com/codeninjasllc/discourse.git
synced 2024-11-23 23:58:31 -05:00
New user education notification was off by one. Also, remove the "basic" restriction on the
"posting too often" message.
This commit is contained in:
parent
0fafe124db
commit
16dc0a7001
2 changed files with 7 additions and 14 deletions
|
@ -21,7 +21,7 @@ class ComposerMessagesFinder
|
|||
education_key = :education_new_reply
|
||||
end
|
||||
|
||||
if count <= SiteSetting.educate_until_posts
|
||||
if count < SiteSetting.educate_until_posts
|
||||
education_posts_text = I18n.t('education.until_posts', count: SiteSetting.educate_until_posts)
|
||||
return {templateName: 'composer/education',
|
||||
wait_for_typing: true,
|
||||
|
@ -56,11 +56,8 @@ class ComposerMessagesFinder
|
|||
# We only care about replies to topics
|
||||
return unless replying? && @details[:topic_id] &&
|
||||
|
||||
# For users who are not new
|
||||
@user.has_trust_level?(:basic) &&
|
||||
|
||||
# And who have posted enough
|
||||
(@user.post_count > SiteSetting.educate_until_posts) &&
|
||||
(@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))
|
||||
|
|
|
@ -28,12 +28,12 @@ describe ComposerMessagesFinder do
|
|||
end
|
||||
|
||||
it "returns a message for a user who has not posted any topics" do
|
||||
user.expects(:created_topic_count).returns(10)
|
||||
user.expects(:created_topic_count).returns(9)
|
||||
finder.check_education_message.should be_present
|
||||
end
|
||||
|
||||
it "returns no message when the user has posted enough topics" do
|
||||
user.expects(:created_topic_count).returns(11)
|
||||
user.expects(:created_topic_count).returns(10)
|
||||
finder.check_education_message.should be_blank
|
||||
end
|
||||
end
|
||||
|
@ -46,12 +46,12 @@ describe ComposerMessagesFinder do
|
|||
end
|
||||
|
||||
it "returns a message for a user who has not posted any topics" do
|
||||
user.expects(:post_count).returns(10)
|
||||
user.expects(:post_count).returns(9)
|
||||
finder.check_education_message.should be_present
|
||||
end
|
||||
|
||||
it "returns no message when the user has posted enough topics" do
|
||||
user.expects(:post_count).returns(11)
|
||||
user.expects(:post_count).returns(10)
|
||||
finder.check_education_message.should be_blank
|
||||
end
|
||||
end
|
||||
|
@ -129,13 +129,9 @@ describe ComposerMessagesFinder do
|
|||
context "reply" do
|
||||
let(:finder) { ComposerMessagesFinder.new(user, composerAction: 'reply', topic_id: topic.id) }
|
||||
|
||||
it "does not give a message to new users" do
|
||||
user.trust_level = TrustLevel.levels[:newuser]
|
||||
finder.check_sequential_replies.should be_blank
|
||||
end
|
||||
|
||||
it "does not give a message to users who are still in the 'education' phase" do
|
||||
user.stubs(:post_count).returns(10)
|
||||
user.stubs(:post_count).returns(9)
|
||||
finder.check_sequential_replies.should be_blank
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in a new issue