mirror of
https://github.com/discourse/discourse.git
synced 2024-11-23 01:16:38 -06:00
FIX: Bot should only respond to regular posts.
This commit is contained in:
parent
0c203e61cd
commit
3621647fb5
@ -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
|
||||
|
||||
|
@ -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!')
|
||||
|
Loading…
Reference in New Issue
Block a user