FIX: Capybara diet upgrade, can eat real 🌿 now (#11040)

More seriously: discobot wasn't reacting properly if users used their
emoji keyboard to insert a real herb emoji, which works just as well
in a real post.

While we're here, use String#include? instead of constructing a new regexp.

https://meta.discourse.org/t/capybaras-dont-eat-real-emojis/168361
This commit is contained in:
Kane York
2020-10-27 07:49:22 -07:00
committed by GitHub
parent e35fcd3340
commit 03503a37be
2 changed files with 22 additions and 1 deletions

View File

@ -141,6 +141,10 @@ module DiscourseNarrativeBot
':herb:'
end
def self.search_answer_emoji
"\u{1F33F}"
end
def self.reset_trigger
I18n.t('discourse_narrative_bot.new_user_narrative.reset_trigger')
end
@ -567,7 +571,7 @@ module DiscourseNarrativeBot
post_topic_id = @post.topic_id
return unless valid_topic?(post_topic_id)
if @post.raw.match(/#{NewUserNarrative.search_answer}/)
if @post.raw.include?(NewUserNarrative.search_answer) || @post.raw.include?(NewUserNarrative.search_answer_emoji)
fake_delay
reply_to(@post, I18n.t("#{I18N_KEY}.search.reply", i18n_post_args(search_url: url_helpers(:search_url))))
else