discourse/plugins/automation/spec/triggers
Gabriel Grubba 0d62863951
FEATURE: Add trigger_on option to topic_tags_changed automation (#30391)
* FEATURE: default value to fields in automation

This PR adds the property `extra.default_value` to the fields in automation. This property is used to set the default value of the field.

Reducing the nil checks we have to do in automation fields.

I've added only testing in the `da-choices-field-test.js` file, but we could add tests to all the fields.

* FEATURE: Add trigger_on option to `topic_tags_changed` automation

This new field will allow users to specify when the trigger should be fired. The options are:
- `tags_added_or_removed`: The trigger will be fired when tags are added or removed from the topic.
- `tags_added`: The trigger will be fired when tags are added to the topic.
- `tags_removed`: The trigger will be fired when tags are removed from the topic.

This PR also brings a migration to set the `trigger_on` field to `tags_added_or_removed` for all existing `topic_tags_changed` automations.

* DEV: reorganize the specs in context blocks

* DEV: migration to add trigger_on field default value to topic_tags_changed_trigger

* DEV: `down` migration for `add_trigger_on_field_default_value_to_topic_tags_changed_trigger` migration

* Update plugins/automation/lib/discourse_automation/triggers/topic_tags_changed.rb

Co-authored-by: Joffrey JAFFEUX <j.jaffeux@gmail.com>

* Update plugins/automation/config/locales/client.en.yml

Co-authored-by: Joffrey JAFFEUX <j.jaffeux@gmail.com>

* DEV: lint files and update topic_tags_changed trigger to use `default_value`

* Revert "FEATURE: default value to fields in automation"

This reverts commit 4d32635c69.

* DEV: remove migration file

---------

Co-authored-by: Joffrey JAFFEUX <j.jaffeux@gmail.com>
2025-01-06 11:22:39 -03:00
..
after_post_cook_spec.rb DEV: Convert some files to autoloading and various improvements (#26860) 2024-05-06 23:12:55 +03:00
category_created_edited_spec.rb DEV: Convert some files to autoloading and various improvements (#26860) 2024-05-06 23:12:55 +03:00
pm_created_spec.rb UX: Use a dropdown for SSL mode for group SMTP (#27932) 2024-07-18 10:33:14 +10:00
point_in_time_spec.rb DEV: Convert some files to autoloading and various improvements (#26860) 2024-05-06 23:12:55 +03:00
post_created_edited_spec.rb FIX: supports groups field in post_created_edited (#28783) 2024-09-06 17:22:42 +02:00
recurring_spec.rb FIX: Prevent recurring automations from getting stalled under specific conditions (#28913) 2024-09-16 18:23:26 +03:00
stalled_wiki_spec.rb DEV: Catch missing translations during test runs (#26258) 2024-05-24 22:15:53 +08:00
topic_spec.rb DEV: Move array type custom fields to JSON type in automation (#26939) 2024-05-10 18:47:12 +03:00
topic_tags_changed_spec.rb FEATURE: Add trigger_on option to topic_tags_changed automation (#30391) 2025-01-06 11:22:39 -03:00
user_added_to_group_spec.rb DEV: Convert some files to autoloading and various improvements (#26860) 2024-05-06 23:12:55 +03:00
user_badge_granted_spec.rb DEV: Convert some files to autoloading and various improvements (#26860) 2024-05-06 23:12:55 +03:00
user_first_logged_in_spec.rb DEV: Convert some files to autoloading and various improvements (#26860) 2024-05-06 23:12:55 +03:00
user_promoted_spec.rb DEV: Convert some files to autoloading and various improvements (#26860) 2024-05-06 23:12:55 +03:00
user_removed_from_group_spec.rb DEV: Convert some files to autoloading and various improvements (#26860) 2024-05-06 23:12:55 +03:00
user_updated_spec.rb DEV: Move array type custom fields to JSON type in automation (#26939) 2024-05-10 18:47:12 +03:00