Skip to content

Commit f63850b

Browse files
Merge pull request discourse#4534 from tgxworld/do_not_show_education_message_for_pms
FIX: Do not show educational message for PMs.
2 parents b263687 + 9fd3173 commit f63850b

File tree

2 files changed

+23
-1
lines changed

2 files changed

+23
-1
lines changed

lib/composer_messages_finder.rb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ def find
1717

1818
# Determines whether to show the user education text
1919
def check_education_message
20+
return '' if @topic && @topic.archetype == Archetype.private_message
21+
2022
if creating_topic?
2123
count = @user.created_topic_count
2224
education_key = 'education.new-topic'
@@ -35,7 +37,7 @@ def check_education_message
3537
}
3638
end
3739

38-
nil
40+
''
3941
end
4042

4143
# New users have a limited number of replies in a topic

spec/components/composer_messages_finder_spec.rb

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,26 @@
4141
end
4242
end
4343

44+
context 'private message' do
45+
let(:topic) { Fabricate(:private_message_topic) }
46+
47+
context 'starting a new private message' do
48+
let(:finder) { ComposerMessagesFinder.new(user, composer_action: 'createTopic', topic_id: topic.id) }
49+
50+
it 'should return an empty string' do
51+
expect(finder.check_education_message).to eq('')
52+
end
53+
end
54+
55+
context 'replying to a private message' do
56+
let(:finder) { ComposerMessagesFinder.new(user, composer_action: 'reply', topic_id: topic.id) }
57+
58+
it 'should return an empty string' do
59+
expect(finder.check_education_message).to eq('')
60+
end
61+
end
62+
end
63+
4464
context 'creating reply' do
4565
let(:finder) { ComposerMessagesFinder.new(user, composer_action: 'reply') }
4666

0 commit comments

Comments
 (0)