mirror of
https://github.com/discourse/discourse.git
synced 2024-11-22 08:49:06 +08:00
FIX: Do not show educational message for PMs.
This commit is contained in:
parent
b26368709e
commit
9fd317306c
|
@ -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
|
||||
|
|
|
@ -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') }
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user