discourse/plugins/automation/spec
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
..
fabricators FIX: ensures global notices are destroyed on post created (#28684) 2024-09-02 21:17:10 +02:00
integration DEV: Change hide_email_address_taken default to true (#30293) 2024-12-17 10:46:04 +08:00
jobs DEV: Convert some files to autoloading and various improvements (#26860) 2024-05-06 23:12:55 +03:00
lib FIX: adds post_quote as placeholder (#29083) 2024-10-08 21:55:11 +09:00
models UX: simplify and shorten new script flow for automations (#29178) 2024-10-23 14:04:17 -04:00
requests UX: logs when an automation is destroyed (#29565) 2024-11-04 11:12:18 +09:00
scripts DEV: Update rubocop-discourse (#30552) 2025-01-04 13:48:21 +01:00
serializers DEV: Clean up state to prevent flaky tests (#27397) 2024-06-10 08:41:03 +08:00
services DEV: Update rubocop-discourse (#30552) 2025-01-04 13:48:21 +01:00
system DEV: do not check for loading state (#30530) 2025-01-02 11:08:23 +01:00
triggers FEATURE: Add trigger_on option to topic_tags_changed automation (#30391) 2025-01-06 11:22:39 -03:00
plugin_helper.rb DEV: Convert some files to autoloading and various improvements (#26860) 2024-05-06 23:12:55 +03:00