diff --git a/plugins/discourse-narrative-bot/lib/discourse_narrative_bot/track_selector.rb b/plugins/discourse-narrative-bot/lib/discourse_narrative_bot/track_selector.rb index 94fdfd9f831..33c1f0fa9aa 100644 --- a/plugins/discourse-narrative-bot/lib/discourse_narrative_bot/track_selector.rb +++ b/plugins/discourse-narrative-bot/lib/discourse_narrative_bot/track_selector.rb @@ -28,7 +28,7 @@ module DiscourseNarrativeBot def select data = Store.get(@user.id) - if @post && !is_topic_action? + if @post && @post.post_type == Post.types[:regular] && !is_topic_action? is_reply = @input == :reply return if is_reply && reset_track diff --git a/plugins/discourse-narrative-bot/spec/discourse_narrative_bot/track_selector_spec.rb b/plugins/discourse-narrative-bot/spec/discourse_narrative_bot/track_selector_spec.rb index 63b224770ca..39de599ac6a 100644 --- a/plugins/discourse-narrative-bot/spec/discourse_narrative_bot/track_selector_spec.rb +++ b/plugins/discourse-narrative-bot/spec/discourse_narrative_bot/track_selector_spec.rb @@ -104,6 +104,18 @@ describe DiscourseNarrativeBot::TrackSelector do end end + context 'when a non regular post is created' do + it 'should not do anything' do + moderator_post = Fabricate(:moderator_post, user: user, topic: topic) + + expect do + described_class.new( + :reply, user, post_id: moderator_post.id + ).select + end.to_not change { Post.count } + end + end + describe 'when user thank the bot' do it 'should like the post' do post.update!(raw: 'thanks!')