mirror of
https://github.com/discourse/discourse.git
synced 2025-06-02 04:08:41 +08:00
FEATURE: Send a message to new TL2 users and point them to the advanced tutorial (#8335)
* FEATURE: Send a message to new TL2 users and point them to the advanced tutorial * DEV: Use a method to find the discobot user
This commit is contained in:
@ -0,0 +1,19 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Jobs
|
||||
class SendAdvancedTutorialMessage < ::Jobs::Base
|
||||
def execute(args)
|
||||
user = User.find_by(id: args[:user_id])
|
||||
raise Discourse::InvalidParameters.new(:user_id) if user.nil?
|
||||
|
||||
PostCreator.create!(
|
||||
Discourse.system_user,
|
||||
title: I18n.t("discourse_narrative_bot.tl2_promotion_message.subject_template"),
|
||||
raw: I18n.t("discourse_narrative_bot.tl2_promotion_message.text_body_template"),
|
||||
archetype: Archetype.private_message,
|
||||
target_usernames: user.username,
|
||||
skip_validations: true
|
||||
)
|
||||
end
|
||||
end
|
||||
end
|
@ -9,7 +9,7 @@ module Jobs
|
||||
|
||||
title = I18n.t("system_messages.#{type}.subject_template", params)
|
||||
raw = I18n.t("system_messages.#{type}.text_body_template", params)
|
||||
discobot_user = User.find(-2)
|
||||
discobot_user = ::DiscourseNarrativeBot::Base.new.discobot_user
|
||||
|
||||
post = PostCreator.create!(
|
||||
discobot_user,
|
||||
|
Reference in New Issue
Block a user