mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
FIX: Do not show educational message for PMs.
This commit is contained in:
@@ -17,6 +17,8 @@ class ComposerMessagesFinder
|
|||||||
|
|
||||||
# Determines whether to show the user education text
|
# Determines whether to show the user education text
|
||||||
def check_education_message
|
def check_education_message
|
||||||
|
return '' if @topic && @topic.archetype == Archetype.private_message
|
||||||
|
|
||||||
if creating_topic?
|
if creating_topic?
|
||||||
count = @user.created_topic_count
|
count = @user.created_topic_count
|
||||||
education_key = 'education.new-topic'
|
education_key = 'education.new-topic'
|
||||||
@@ -35,7 +37,7 @@ class ComposerMessagesFinder
|
|||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
nil
|
''
|
||||||
end
|
end
|
||||||
|
|
||||||
# New users have a limited number of replies in a topic
|
# New users have a limited number of replies in a topic
|
||||||
|
|||||||
@@ -41,6 +41,26 @@ describe ComposerMessagesFinder do
|
|||||||
end
|
end
|
||||||
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
|
context 'creating reply' do
|
||||||
let(:finder) { ComposerMessagesFinder.new(user, composer_action: 'reply') }
|
let(:finder) { ComposerMessagesFinder.new(user, composer_action: 'reply') }
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user