FIX: when the user is promoted to TL2 invite to advance training (#10752)

Invitation to advanced training should be sent as a separate private message instead of hooking into TL2 promotion message.
This commit is contained in:
Krzysztof Kotlarek
2020-09-28 13:52:33 +10:00
committed by GitHub
parent e7c72cd1e4
commit 902fbd0b7e
3 changed files with 15 additions and 5 deletions

View File

@ -293,12 +293,15 @@ after_initialize do
discobot_username: ::DiscourseNarrativeBot::Base.new.discobot_username,
reset_trigger: "#{::DiscourseNarrativeBot::TrackSelector.reset_trigger} #{::DiscourseNarrativeBot::AdvancedUserNarrative.reset_trigger}")
recipient = args[:post].topic.topic_users.where.not(user_id: args[:post].user_id).last.user
PostCreator.create!(
::DiscourseNarrativeBot::Base.new.discobot_user,
title: I18n.t("discourse_narrative_bot.tl2_promotion_message.subject_template"),
raw: raw,
topic_id: args[:post].topic_id,
skip_validations: true
skip_validations: true,
archetype: Archetype.private_message,
target_usernames: recipient.username
)
end
end