- For `with_images`, ignore `<img>` tags representing emoji or a quote
avatar
- For `with_links` and `with_uploads`, exclude tags starting with the
letter "a" other than `<a>` (like `<aside>`)
- For `with_code`, the `<pre>` tag wasn't being detected because it was
expecting an extra char before the ">"
Im not exactly sure of the reason, but I thought it was related to the
recent `addAdminPluginConfigurationNav`. I followed more closely what
has been made in chat for hooks and it seems to fix the problem.
/t/-/154466
Technically we want to follow DDAU but most of our usage in the code
base are just mutating `@checked`. This will eventually get converted to
form-kit but in the meantime we can just remove this bit of code as it's
doing two times the same thing and you could even end up in the
situation where they both fight for what is the correct value.
- Add a safeguard until we implement pagination for the index, it
ensures we won't try to load more than 500 automations ever.
- Includes the fields of the automation so we don't have an N+1 and also
filter them in ruby land instead of doing two additional queries
- Ensures a field object in the field serializer is capable to find the
loaded automation associated to it instead of trying to reload it
- Includes pending_automations to avoid an N+1
I suspect that by having an integer and not a float sometimes the value
we get is converted to 0.
This is the error we have atm:
```
Failure/Error: measurement = Benchmark.measure { example.run }
expected: 0.75
got: 0.0
(compared using ==)
```
This might not fix it, but it feels right to make this change.
Relaxed restrictions:
- Automation posts are not validated for similarity. This was causing
error when PMs were created by regular user with same content and sent
to different users.
- Don't create warning logs when PM target does not exist anymore. When
for example spammer was deleted, delayed PM is not sent, but it is
correct behaviour;
- Allow tags to be applied even if an automation user is not allowed to
tag;
- Restricted category tags should be visible in configuration UI. Still,
they will be applied only when specific topic belongs to correct
category.
The previous code could attempt to log a `nil` `run_time` if the block
would raise an exception. This commit adds two safeguards:
- rescue any exception to still compute `run_time`
- defaults to `0` if we still don't have any `run_time`
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>
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
- 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>
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.
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.
If Jobs::DiscourseAutomation::Tracker fails during execution of a
pending automation, then the remaining automation were no longer
executed.
Automation may fail for various reasons: a person has PMs disabled, rate
limit is reached, etc.
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.
Stylelint is a css linter: https://stylelint.io/
As part of this change we have added two javascript scripts:
```
pnpm lint:css
pnpm lint:css:fix
```
Look at `.vscode/settings.json.sample` and `.vscode/extensions.json` for
configuration in VSCode.
---------
Co-authored-by: Joffrey JAFFEUX <j.jaffeux@gmail.com>