diff --git a/plugins/discourse-narrative-bot/config/locales/server.en.yml b/plugins/discourse-narrative-bot/config/locales/server.en.yml index 5163997e31c..f0d54c7f550 100644 --- a/plugins/discourse-narrative-bot/config/locales/server.en.yml +++ b/plugins/discourse-narrative-bot/config/locales/server.en.yml @@ -293,7 +293,7 @@ en: - Did you notice you’re now back at the beginning? Feed this poor hungry capybara by **replying with the `:herb:` emoji** and you’ll be automatically taken to the end. + Did you notice you’re now back at the beginning? Feed this poor hungry capybara by **replying with the `%{search_answer}` emoji** and you’ll be automatically taken to the end. reply: |- Yay you found it :tada: diff --git a/plugins/discourse-narrative-bot/lib/discourse_narrative_bot/new_user_narrative.rb b/plugins/discourse-narrative-bot/lib/discourse_narrative_bot/new_user_narrative.rb index df134ac42d3..f85854c32da 100644 --- a/plugins/discourse-narrative-bot/lib/discourse_narrative_bot/new_user_narrative.rb +++ b/plugins/discourse-narrative-bot/lib/discourse_narrative_bot/new_user_narrative.rb @@ -117,7 +117,9 @@ module DiscourseNarrativeBot } } - SEARCH_ANSWER = ':herb:'.freeze + def self.search_answer + ':herb:' + end def self.reset_trigger I18n.t('discourse_narrative_bot.new_user_narrative.reset_trigger') @@ -152,7 +154,7 @@ module DiscourseNarrativeBot raw = <<~RAW #{post.raw} - #{I18n.t("#{I18N_KEY}.search.hidden_message", i18n_post_args)} + #{I18n.t("#{I18N_KEY}.search.hidden_message", i18n_post_args.merge(search_answer: NewUserNarrative.search_answer))} RAW PostRevisor.new(post, topic).revise!( @@ -495,7 +497,7 @@ module DiscourseNarrativeBot post_topic_id = @post.topic_id return unless valid_topic?(post_topic_id) - if @post.raw.match(/#{SEARCH_ANSWER}/) + if @post.raw.match(/#{NewUserNarrative.search_answer}/) fake_delay reply_to(@post, I18n.t("#{I18N_KEY}.search.reply", i18n_post_args(search_url: url_helpers(:search_url)))) else 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 1b35acd3d88..b7c5ec34d4c 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 @@ -946,7 +946,9 @@ describe DiscourseNarrativeBot::NewUserNarrative do expect(narrative.get_data(user)[:state].to_sym).to eq(:tutorial_search) expect(post.reload.topic.first_post.raw).to include(I18n.t( - "discourse_narrative_bot.new_user_narrative.search.hidden_message", base_uri: '' + "discourse_narrative_bot.new_user_narrative.search.hidden_message", + base_uri: '', + search_answer: described_class.search_answer )) end @@ -963,7 +965,7 @@ describe DiscourseNarrativeBot::NewUserNarrative do it 'should create the right reply' do post.update!( - raw: "#{described_class::SEARCH_ANSWER} this is a capybara" + raw: "#{described_class.search_answer} this is a capybara" ) expect do