FIX: TL2 promotion message and advance training (#10679)

This is a little bit of refactoring. Core Discourse should have default promotion message for TL2.

In addition, when the Discobot plugin is enabled, the user is invited to advanced training
This commit is contained in:
Krzysztof Kotlarek
2020-09-22 10:17:52 +10:00
committed by GitHub
parent 8867bd4abe
commit 0bb51dcbfa
11 changed files with 76 additions and 72 deletions

View File

@ -1,23 +0,0 @@
# frozen_string_literal: true
module Jobs
class SendAdvancedTutorialMessage < ::Jobs::Base
def execute(args)
user = User.find_by(id: args[:user_id])
return if user.nil?
raw = I18n.t("discourse_narrative_bot.tl2_promotion_message.text_body_template",
discobot_username: ::DiscourseNarrativeBot::Base.new.discobot_username,
reset_trigger: "#{::DiscourseNarrativeBot::TrackSelector.reset_trigger} #{::DiscourseNarrativeBot::AdvancedUserNarrative.reset_trigger}")
PostCreator.create!(
Discourse.system_user,
title: I18n.t("discourse_narrative_bot.tl2_promotion_message.subject_template"),
raw: raw,
archetype: Archetype.private_message,
target_usernames: user.username,
skip_validations: true
)
end
end
end