FIX: Do not show educational message for PMs.

This commit is contained in:
Guo Xiang Tan 2016-11-04 17:06:53 +08:00
parent b26368709e
commit 9fd317306c
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') }