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

@ -401,6 +401,11 @@ class User < ActiveRecord::Base
Jobs.enqueue(:send_system_message, user_id: id, message_type: "welcome_tl1_user")
end
def enqueue_tl2_promotion_message
return unless SiteSetting.send_tl2_promotion_message
Jobs.enqueue(:send_system_message, user_id: id, message_type: "tl2_promotion_message")
end
def enqueue_staff_welcome_message(role)
return unless staff?
return if role == :admin && User.real.where(admin: true).count == 1