Merge pull request #4534 from tgxworld/do_not_show_education_message_for_pms

FIX: Do not show educational message for PMs.
This commit is contained in:
Jeff Atwood 2016-11-04 10:37:44 +01:00 committed by GitHub
commit f63850b3db
2 changed files with 23 additions and 1 deletions

View File

@ -17,6 +17,8 @@ class ComposerMessagesFinder
# Determines whether to show the user education text
def check_education_message
return '' if @topic && @topic.archetype == Archetype.private_message
if creating_topic?
count = @user.created_topic_count
education_key = 'education.new-topic'
@ -35,7 +37,7 @@ class ComposerMessagesFinder
}
end
nil
''
end
# New users have a limited number of replies in a topic

View File

@ -41,6 +41,26 @@ describe ComposerMessagesFinder do
end
end
context 'private message' do
let(:topic) { Fabricate(:private_message_topic) }
context 'starting a new private message' do
let(:finder) { ComposerMessagesFinder.new(user, composer_action: 'createTopic', topic_id: topic.id) }
it 'should return an empty string' do
expect(finder.check_education_message).to eq('')
end
end
context 'replying to a private message' do
let(:finder) { ComposerMessagesFinder.new(user, composer_action: 'reply', topic_id: topic.id) }
it 'should return an empty string' do
expect(finder.check_education_message).to eq('')
end
end
end
context 'creating reply' do
let(:finder) { ComposerMessagesFinder.new(user, composer_action: 'reply') }