From 329969ea20296b74b77e8e568e63f635cefa7b3a Mon Sep 17 00:00:00 2001 From: Guo Xiang Tan Date: Tue, 7 May 2019 10:53:51 +0800 Subject: [PATCH] FIX: Discobot mention tutorial should be case insensitive. --- .../lib/discourse_narrative_bot/actions.rb | 5 ++++- .../spec/discourse_narrative_bot/new_user_narrative_spec.rb | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/plugins/discourse-narrative-bot/lib/discourse_narrative_bot/actions.rb b/plugins/discourse-narrative-bot/lib/discourse_narrative_bot/actions.rb index 349aedd5237..ca75d080891 100644 --- a/plugins/discourse-narrative-bot/lib/discourse_narrative_bot/actions.rb +++ b/plugins/discourse-narrative-bot/lib/discourse_narrative_bot/actions.rb @@ -69,7 +69,10 @@ module DiscourseNarrativeBot valid = false doc.css(".mention").each do |mention| - valid = true if mention.text == "@#{self.discobot_user.username}" + if mention.text.downcase == "@#{self.discobot_user.username}".downcase + valid = true + break + end end valid diff --git a/plugins/discourse-narrative-bot/spec/discourse_narrative_bot/new_user_narrative_spec.rb b/plugins/discourse-narrative-bot/spec/discourse_narrative_bot/new_user_narrative_spec.rb index a74ca8b4603..5fca22bdc9e 100644 --- a/plugins/discourse-narrative-bot/spec/discourse_narrative_bot/new_user_narrative_spec.rb +++ b/plugins/discourse-narrative-bot/spec/discourse_narrative_bot/new_user_narrative_spec.rb @@ -803,7 +803,7 @@ describe DiscourseNarrativeBot::NewUserNarrative do it 'should create the right reply' do post.update!( - raw: '@discobot hello how are you doing today?' + raw: '@disCoBot hello how are you doing today?' ) narrative.expects(:enqueue_timeout_job).with(user)