FIX: Skip trigger match should be case insensitive.
https://meta.discourse.org/t/discobot-not-skipping-tutorial/68498
This commit is contained in:
parent
8bd7cfedfd
commit
950fa9e3a8
|
@ -217,9 +217,7 @@ module DiscourseNarrativeBot
|
|||
def skip_track?
|
||||
if @is_pm_to_bot
|
||||
post_raw = @post.raw
|
||||
|
||||
post_raw.match(/^@#{self.discobot_user.username} #{self.class.skip_trigger}/i) ||
|
||||
post_raw.strip == self.class.skip_trigger
|
||||
post_raw.match(/((^@#{self.discobot_user.username} #{self.class.skip_trigger})|(^#{self.class.skip_trigger}$))/i)
|
||||
else
|
||||
false
|
||||
end
|
||||
|
|
|
@ -162,7 +162,7 @@ RSpec.describe DiscourseNarrativeBot::AdvancedUserNarrative do
|
|||
|
||||
describe 'when reply contains the skip trigger' do
|
||||
it 'should create the right reply' do
|
||||
post.update!(raw: "@#{discobot_user.username} #{skip_trigger}")
|
||||
post.update!(raw: "@#{discobot_user.username} #{skip_trigger.upcase}")
|
||||
described_class.any_instance.expects(:enqueue_timeout_job).with(user)
|
||||
|
||||
DiscourseNarrativeBot::TrackSelector.new(:reply, user, post_id: post.id).select
|
||||
|
@ -225,7 +225,7 @@ RSpec.describe DiscourseNarrativeBot::AdvancedUserNarrative do
|
|||
|
||||
describe 'when reply contains the skip trigger' do
|
||||
it 'should create the right reply' do
|
||||
post.update!(raw: skip_trigger)
|
||||
post.update!(raw: skip_trigger.upcase)
|
||||
described_class.any_instance.expects(:enqueue_timeout_job).with(user)
|
||||
|
||||
DiscourseNarrativeBot::TrackSelector.new(:reply, user, post_id: post.id).select
|
||||
|
|
|
@ -213,7 +213,7 @@ describe DiscourseNarrativeBot::NewUserNarrative do
|
|||
|
||||
describe 'when reply contains the skip trigger' do
|
||||
it 'should create the right reply' do
|
||||
post.update!(raw: "@#{discobot_user.username} #{skip_trigger}")
|
||||
post.update!(raw: "@#{discobot_user.username} #{skip_trigger.upcase}")
|
||||
described_class.any_instance.expects(:enqueue_timeout_job).with(user)
|
||||
|
||||
DiscourseNarrativeBot::TrackSelector.new(:reply, user, post_id: post.id).select
|
||||
|
@ -286,7 +286,7 @@ describe DiscourseNarrativeBot::NewUserNarrative do
|
|||
describe 'when user replies to the topic' do
|
||||
describe 'when reply contains the skip trigger' do
|
||||
it 'should create the right reply' do
|
||||
post.update!(raw: skip_trigger)
|
||||
post.update!(raw: skip_trigger.upcase)
|
||||
described_class.any_instance.expects(:enqueue_timeout_job).with(user)
|
||||
|
||||
DiscourseNarrativeBot::TrackSelector.new(:reply, user, post_id: post.id).select
|
||||
|
|
Loading…
Reference in New Issue