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
|
def select
|
||||||
data = Store.get(@user.id)
|
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
|
is_reply = @input == :reply
|
||||||
return if is_reply && reset_track
|
return if is_reply && reset_track
|
||||||
|
|
||||||
|
|
|
@ -104,6 +104,18 @@ describe DiscourseNarrativeBot::TrackSelector do
|
||||||
end
|
end
|
||||||
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
|
describe 'when user thank the bot' do
|
||||||
it 'should like the post' do
|
it 'should like the post' do
|
||||||
post.update!(raw: 'thanks!')
|
post.update!(raw: 'thanks!')
|
||||||
|
|
Loading…
Reference in New Issue