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:
Roman Rizzi
2019-11-13 18:31:49 -03:00
committed by GitHub
parent a4b89f8187
commit c63e84dc62
11 changed files with 69 additions and 8 deletions

View File

@ -33,6 +33,7 @@ after_initialize do
'../autoload/jobs/narrative_timeout.rb',
'../autoload/jobs/narrative_init.rb',
'../autoload/jobs/send_default_welcome_message.rb',
'../autoload/jobs/send_advanced_tutorial_message.rb',
'../autoload/jobs/onceoff/grant_badges.rb',
'../autoload/jobs/onceoff/remap_old_bot_images.rb',
'../lib/discourse_narrative_bot/actions.rb',
@ -245,4 +246,13 @@ after_initialize do
)
end
end
self.on(:user_promoted) do |args|
promoted_from_tl1 = args[:new_trust_level] == TrustLevel[2] &&
args[:old_trust_level] == TrustLevel[1]
if SiteSetting.discourse_narrative_bot_enabled && promoted_from_tl1
Jobs.enqueue(:send_advanced_tutorial_message, user_id: args[:user_id])
end
end
end