mirror of
https://github.com/discourse/discourse.git
synced 2025-05-30 07:11:34 +08:00
Refactor search_answer
to be dynamically inserted so it can be changed
This commit is contained in:
@ -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
|
||||
|
Reference in New Issue
Block a user