mirror of
https://github.com/discourse/discourse.git
synced 2025-05-22 16:11:08 +08:00
FEATURE: send message when a user reaches tl1
This commit is contained in:
@ -53,7 +53,7 @@ describe Promotion do
|
||||
end
|
||||
end
|
||||
|
||||
context "that has done the requisite things" do
|
||||
context "that has not done the requisite things" do
|
||||
it "does not promote the user" do
|
||||
user.created_at = 1.minute.ago
|
||||
stat = user.user_stat
|
||||
@ -66,6 +66,32 @@ describe Promotion do
|
||||
end
|
||||
end
|
||||
|
||||
context "may send tl1 promotion messages" do
|
||||
before do
|
||||
stat = user.user_stat
|
||||
stat.topics_entered = SiteSetting.tl1_requires_topics_entered
|
||||
stat.posts_read_count = SiteSetting.tl1_requires_read_posts
|
||||
stat.time_read = SiteSetting.tl1_requires_time_spent_mins * 60
|
||||
end
|
||||
it "sends promotion message by default" do
|
||||
SiteSetting.send_tl1_welcome_message = true
|
||||
Jobs.expects(:enqueue).with(
|
||||
:send_system_message,
|
||||
user_id: user.id, message_type: "welcome_tl1_user"
|
||||
).once
|
||||
@result = promotion.review
|
||||
end
|
||||
|
||||
it "can be turned off" do
|
||||
SiteSetting.send_tl1_welcome_message = false
|
||||
Jobs.expects(:enqueue).with(
|
||||
:send_system_message,
|
||||
user_id: user.id, message_type: "welcome_tl1_user"
|
||||
).never
|
||||
@result = promotion.review
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
context "basic" do
|
||||
|
Reference in New Issue
Block a user