Commit Graph

70 Commits

Author SHA1 Message Date
37e72e9ad7 Update translations (#31994) 2025-03-25 17:22:59 +01:00
Sam
8c8bc94ed8 FEATURE: Add automation statistics tracking to Automation (#31921)
introduces comprehensive statistics tracking for the Discourse
Automation plugin, allowing users to monitor the performance and
execution patterns of their automations:

- Add `discourse_automation_stats` table to track execution metrics
including run counts, execution times, and performance data
- Create a new `Stat` model to handle tracking and retrieving automation
statistics
- Update the admin UI to display automation stats (runs today/this
week/month and last run time)
- Modernize the automation list interface using Glimmer components
- Replace the older enable/disable icon with a toggle switch for better
UX
- Add schema annotations to existing models for better code
documentation
- Include extensive test coverage for the new statistics functionality

This helps administrators understand how their automations are
performing and identify potential bottlenecks or optimization
opportunities.

---------

Co-authored-by: Joffrey JAFFEUX <j.jaffeux@gmail.com>
Co-authored-by: Ted Johansson <ted@discourse.org>
2025-03-21 12:53:26 +11:00
Sam
0e62acd57f FEATURE: enhance post created edited trigger in automation (#31900)
1. **Multiselect Support for Choice Fields**
   - Added a `multiselect` option to the choices field component
   - Updated Field model to accept arrays as values for choices fields

2. **Post Content Feature Filtering**
   - Added ability to filter posts based on content features:
     - Posts with images
     - Posts with links
     - Posts with code blocks
     - Posts with uploads

3. **Improved Group Filtering**
- Renamed `restricted_user_group` to `restricted_groups` to allow
filtering by multiple groups
- Added `excluded_groups` to replace `ignore_group_members` which was
complex for end users
- Renamed `restricted_groups` to `restricted_inbox_groups` for more
specific PM filtering and clarity.

4. **Public Topics Filter**
- Added a "Public Topics" filter option that excludes all secure
categories
2025-03-20 08:05:06 +11:00
464da9a4fb Update translations (#31875) 2025-03-18 15:08:14 +01:00
d3c68ef1a7 Update translations (#31747) 2025-03-11 17:47:42 +01:00
Sam
50310ea96d FEATURE: improve post_created_edited automation triggers (#31694)
- Allow deciding if we include or exclude sub categories
- Allow filtering to only look at PMs or Topics
- Allow selection of multiple categories
- Migrations to carry all data into new structure

---------

Co-authored-by: Joffrey JAFFEUX <j.jaffeux@gmail.com>
2025-03-08 08:18:30 +11:00
b467fe1347 Update translations (#31617) 2025-03-04 16:12:11 +01:00
699541af75 FEATURE: limits post created edited trigger to a group (#31523)
This commit allows admins to limit the post created/edited trigger
execution to a specific post user group.

It's for example useful if you want to auto tag all the topics created
by member of a specific group.
2025-02-26 10:52:40 +01:00
61d8cce569 Update translations (#31501) 2025-02-25 15:11:27 +01:00
44aa0eda27 UX: add automation script description for pm sender (#31478)
Adds a description to highlight the need for sender to have correct
permissions when sending PM. Without the correct permissions the PM is
not sent and a message is added to the site logs.
2025-02-24 15:54:41 +04:00
122e1384bc Update translations (#31470) 2025-02-24 15:11:55 +11:00
b37b51d15f Update translations (#31377) 2025-02-18 14:51:47 +01:00
e925f9b7e8 Update translations (#31276) 2025-02-11 16:43:08 +01:00
f439bf14cc DEV: Refactor the Automation Plugin UI to match admin UI guidelines (#31060)
This change updates the Automation plugin to make use of the `use_new_show_route` plugin flag, as well as generally updating the UI to match current admin UI guidelines. Notable changes include:

- Moving template/router/controller files to make use of the `admin.adminPlugins.show` route.
- Changing the URIs from `/admin/plugins/discourse-automation` to `/admin/plugins/automation`, to match the `PLUGIN_NAME`.
- Adding UI wrappers around the New/Edit forms, and polishing the list of defined automations.
2025-02-05 14:34:15 +11:00
8d810f9271 Update translations (#31123) 2025-02-03 16:37:54 +01:00
4e2a982e91 Update translations (#31035) 2025-01-31 10:48:44 +01:00
f0d6e9758d Update translations (#30898) 2025-01-21 15:55:30 +01:00
496a739788 Update translations (#30765) 2025-01-14 16:19:49 +01:00
1d7b1e587a Update translations 2025-01-07 21:56:56 +01:00
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 4d32635c695b1da36dbe3343bb55c223a720106a.

* DEV: remove migration file

---------

Co-authored-by: Joffrey JAFFEUX <j.jaffeux@gmail.com>
2025-01-06 11:22:39 -03:00
6c7eaf99af Update translations (#30434) 2025-01-03 14:01:32 +01:00
ddca2ca629 UX: Apply admin table to Automation settings page (#30341)
* UX: Apply admin table classes for consistent mobile styling on the automation page

* UX: Remove icon beside the automation page title

* DEV: Add status label to translations

* UX: Reorder the status and name when on mobile

* DEV: Add comment explaining tablet-specific status reorder

* DEV: Apply prettier
2024-12-19 05:07:14 -07:00
1631c39391 Update translations (#30319) 2024-12-18 15:19:37 +01:00
7c00c52c36 UX: Rename private to personal messages in the interface (#29679)
Rename "private messages" to "personal messages" in the interface
2024-12-12 11:44:19 +11:00
c65192a7a2 Update translations (#30202) 2024-12-10 20:16:34 +01:00
b9f183e2c3 Update translations (#29934) 2024-11-26 23:14:56 +01:00
abfd065ff0 Update translations (#29835) 2024-11-20 00:21:25 +01:00
d7503a6153 Update translations (#29715) 2024-11-12 14:54:38 +01:00
8a201c1e92 Update translations (#29595) 2024-11-05 16:55:45 +01:00
932bd6ba85 UX: logs when an automation is destroyed (#29565)
Some checks are pending
Licenses / run (push) Waiting to run
Linting / run (push) Waiting to run
Tests / ${{ matrix.target }} ${{ matrix.build_type }} (frontend, themes) (push) Waiting to run
Tests / ${{ matrix.target }} ${{ matrix.build_type }} (system, chat) (push) Waiting to run
Tests / ${{ matrix.target }} ${{ matrix.build_type }} (system, core) (push) Waiting to run
Tests / ${{ matrix.target }} ${{ matrix.build_type }} (system, plugins) (push) Waiting to run
Tests / ${{ matrix.target }} ${{ matrix.build_type }} (system, themes) (push) Waiting to run
Tests / core frontend (${{ matrix.browser }}) (Chrome) (push) Waiting to run
Tests / core frontend (${{ matrix.browser }}) (Firefox ESR) (push) Waiting to run
Tests / core frontend (${{ matrix.browser }}) (Firefox Evergreen) (push) Waiting to run
Tests / ${{ matrix.target }} ${{ matrix.build_type }} (annotations, core) (push) Waiting to run
Tests / ${{ matrix.target }} ${{ matrix.build_type }} (backend, core) (push) Waiting to run
Tests / ${{ matrix.target }} ${{ matrix.build_type }} (backend, plugins) (push) Waiting to run
Tests / ${{ matrix.target }} ${{ matrix.build_type }} (frontend, plugins) (push) Waiting to run
A `UserHistory` entry will now be created when an automation is destroyed. This is visible in `/admin/logs/staff_action_logs`. id, name, trigger and script will be logged.

This commit also creates a service `DestroyAutomation` to hold all the destroy automation logic.

---------
Co-authored-by: Martin Brennan <mjrbrennan@gmail.com>
2024-11-04 11:12:18 +09:00
4d0ed2e146 Update translations (#29467) 2024-10-29 15:31:41 +01:00
d471c01ff6 UX: simplify and shorten new script flow for automations (#29178) 2024-10-23 14:04:17 -04:00
28c5fb94d3 Update translations (#29335) 2024-10-22 22:44:33 +09:00
e5f2416eff Update translations (#29212) 2024-10-16 17:52:01 +09:00
53f9c81790 FEATURE: add trigger_with_pms option to topic tags changed automation trigger (#29122) 2024-10-09 09:51:40 -03:00
a4531be580 Update translations (#29123) 2024-10-08 20:21:43 +02:00
76ad581f67 Update translations 2024-10-02 08:55:44 +02:00
91ba2a4aab DEV: Add debug logging for automation recurring trigger (#28829)
We're seeing a problem where some recurring automations end up in a state where they don't have any `pending_automations` records scheduled which effectively makes the recurring automation dead. We need to add some debugging to figure out what might be causing this problem.

Internal topic: t/138045.
2024-09-11 01:29:15 +03:00
ad7d5426d8 FIX: supports groups field in post_created_edited (#28783)
⚠️ This commit is a revert of a revert due to a migration which was causing `{}` metadata to be transformed into `{"value": [null]}`. The new migration shouldn't cause this and will also clean the existing errors, there shouldn't  be any data loss given the affected fields where not containing actual data. We might want to stop storing these empty fields in the future.

To achieve it, this commit does the following:
- create a new `groups field`, ideally we would have reused the existing group field, but many automations now have the expectation that this field will return a group id and not an array of group ids, which makes it a dangerous change
- alter the code in `post_created_edited` to use this new groups field and change the logic to use an array
- migrate the existing group fields post_created_edited automations to change name from `restricted_group` to `restricted_groups`, the component from `group` to `groups` and the metadata from `{"value": integer}` to `{"value": [integer]}`

<!-- NOTE: All pull requests should have tests (rspec in Ruby, qunit in JavaScript). If your code does not include test coverage, please include an explanation of why it was omitted. -->
2024-09-06 17:22:42 +02:00
5f5680dbaf Revert "FIX: supports groups field in post_created_edited (#28773)" (#28781)
This reverts commit eb3a1c72179c179af358daf41b167e337cc7b454.
2024-09-06 16:10:53 +02:00
eb3a1c7217 FIX: supports groups field in post_created_edited (#28773)
To achieve this this commit does the following:
- create a new `groups field, ideally we would have reused the existing group field, but many automations now have the expectation that this field will return a group id and not an array of group ids, which makes it a dangerous change
- alter the code in `post_created_edited` to use this new groups field and change the logic to use an array
- migrate the existing group fields post_created_edited automations to change name from `restricted_group` to `restricted_groups`, the component from `group` to `groups` and the metadata from `{"value": integer}` to `{"value": [integer]}`
2024-09-06 15:04:19 +02:00
9b630c8cca DEV: adds post_created_edited suport to chat (#28757) 2024-09-05 17:17:18 +02:00
b1e539c1b9 Update translations (#28682) 2024-09-02 18:00:43 +02:00
68c9553251 Update translations (#28577) 2024-08-29 15:37:52 -04:00
715f49c3fe FEATURE: Post created/edited trigger can skip posts created via email (#28615) 2024-08-28 17:34:35 -03:00
05e120a9f2 Update translations (#28246) 2024-08-13 16:31:24 +02:00
ec46487870 FEATURE: Added trigger for topic tags changed (#28176)
* FEATURE: Added trigger for topic tags changed

* DEV: register new file in plugin.rb

* DEV: update to use already existing `:topic_tags_changed` event

* DEV: Add tests to topic_tags_changed trigger

remove `watching_user` field

* DEV: add more tests to topic_tags_changed_spec.rb

* DEV: update tests and implementation for topic tags changed automation trigger

* DEV: update checking for tags changed automation

* DEV: Update argument application for `handle_topic_tags_changed`
2024-08-02 09:58:51 -03:00
1e76fbe207 Update translations (#28146) 2024-07-31 00:14:19 +02:00
f5fc49f5db Update translations (#28115)
* Update translations

* DEV: Spec failed because of translation update

---------

Co-authored-by: Gerhard Schlager <gerhard.schlager@discourse.org>
2024-07-29 15:16:40 +02:00
5b5d5b4b4a Update translations (#28041) 2024-07-23 15:23:42 +02:00