mirror of
https://github.com/discourse/discourse.git
synced 2025-06-05 14:07:30 +08:00
FEATURE: Add 'New users only' option to user_updated trigger (#26648)
This commit adds a new option to the `user_updated` trigger of the automation plugin to only trigger an automation for new users that join after the automation is enabled. Internal topic: t/125829/9.
This commit is contained in:
@ -165,4 +165,21 @@ describe DiscourseAutomation::Automation do
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe "after_destroy" do
|
||||
fab!(:automation) { Fabricate(:automation, enabled: false) }
|
||||
fab!(:automation2) { Fabricate(:automation, enabled: false) }
|
||||
|
||||
it "deletes user custom fields that indicate new users" do
|
||||
user = Fabricate(:user)
|
||||
user.custom_fields[automation.new_user_custom_field_name] = "1"
|
||||
user.custom_fields[automation2.new_user_custom_field_name] = "1"
|
||||
user.save_custom_fields
|
||||
|
||||
automation.destroy!
|
||||
user.reload
|
||||
|
||||
expect(user.custom_fields).to eq({ automation2.new_user_custom_field_name => "1" })
|
||||
end
|
||||
end
|
||||
end
|
||||
|
Reference in New Issue
Block a user