Commit Graph

143 Commits

Author SHA1 Message Date
7b2b08cf89 DEV: [gjs-codemod] Convert automation/styleguide/other to gjs
Co-authored-by: Jarek Radosz <jarek@cvx.dev>
2025-04-14 15:36:16 +01:00
3462113bd4 DEV: [gjs-codemod] merge js and hbs 2025-04-14 15:27:52 +01:00
1eb953ca57 DEV: [gjs-codemod] renamed hbs to gjs 2025-04-14 15:27:47 +01:00
3ca507e008 DEV: [gjs-codemod] renamed js to gjs 2025-04-14 15:27:45 +01:00
6e654bc596 FIX: relax automation restrictions (#32238)
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.
2025-04-11 07:27:43 +08:00
01ce003b8e FIX: logs time even when automation raises (#32254)
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`
2025-04-10 11:05:53 +02:00
29cbbd6b31 DEV: Fix Lint/ShadowingOuterLocalVariable (#32036)
unblocks a rubocop update
2025-03-27 13:50:24 +01:00
37e72e9ad7 Update translations (#31994) 2025-03-25 17:22:59 +01:00
Sam
afd5975041 FIX: looking at wrong period in statsText (#31986) 2025-03-25 17:18:02 +11:00
Sam
ad992d7b2d FIX: destroy automation not working (#31945)
We had some legacy code due to previous controller based automation

---------

Co-authored-by: Alan Guo Xiang Tan <gxtan1990@gmail.com>
2025-03-21 15:22:33 +11: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
f09c8f61c8 DEV: Fix flaky automation system test (#31867)
This commit updates `PageObjects::Pages::Automation#update` to check
that the button is not disabled before clicking the button.

### Reviewer notes

Instances of flakiness:
1.
https://github.com/discourse/discourse/actions/runs/13864294630/job/38801362996
2.
https://github.com/discourse/discourse/actions/runs/13392214535/job/37402368070
2025-03-18 15:13:59 +08:00
d3c68ef1a7 Update translations (#31747) 2025-03-11 17:47:42 +01:00
25048b5a8d DEV: Update lint-configs and rubocop-discourse (#31728)
…and autofix issues

---------

Co-authored-by: David Taylor <david@taylorhq.com>
2025-03-10 19:52:19 +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
4bb1e0d113 FIX: loop detection works as expected and does not need logging (#31686)
Logging creates impression that something is not working while
everything is working as expected.
2025-03-07 16:41:29 +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
23cfab8f19 FIX: Recover from failing automations (#31413)
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.
2025-02-20 12:45:06 +02: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
a1bbbbda02 DEV: Promote historic post_deploy migrations for core plugins. (#30987)
This commit promotes all post_deploy migrations which existed in
Discourse v3.3.0 (timestamp <= 20240717053710)
2025-01-24 11:47:03 -03:00
f0d6e9758d Update translations (#30898) 2025-01-21 15:55:30 +01:00
d88ee33eb6 DEV: Introduce stylelint (#29852)
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>
2025-01-20 15:27:42 +00:00
496a739788 Update translations (#30765) 2025-01-14 16:19:49 +01:00
0ed4b09527 DEV: Move discourse-common/(utils|lib) to discourse/lib (#30733)
`discourse-common` was created in the past to share logic between the
'wizard' app and the main 'discourse' app. Since then, the wizard has
been consolidated into the main app, so the separation of
`discourse-common` is no longer useful.

This commit moves `discourse-common/(lib|utils)/*` into
`discourse/lib/*`, adds shims for the imports, and updates existing
uses in core.
2025-01-13 13:02:49 +00:00
6dd306be55 DEV: Update a defensive test which case is no longer possible (#30640)
Introduced in https://github.com/discourse/discourse/pull/30263, it is also causing flaky tests.
2025-01-08 21:06:04 +08: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
a4c2653db8 DEV: Update rubocop-discourse (#30552)
…and autofix the issues
2025-01-04 13:48:21 +01:00
6c7eaf99af Update translations (#30434) 2025-01-03 14:01:32 +01:00
80cda1212e DEV: do not check for loading state (#30530)
This shouldn't be necessary and is already causing flakyness today.
2025-01-02 11:08:23 +01:00
5711bf6f27 DEV: Move admin config pages out of /customize/ sub-route (#30511)
The customize routes add CSS classes that make these admin
config pages look different from the ones under /admin/config.
We want all config routes to be under /admin/config as well.

This commit moves the emoji, user fields, and permalinks pages
out of customize and into config, updating all references and
adding more rails routes as needed.

Also renames admin emojis route to emoji, emoji is singular and plural.
2025-01-02 09:13:11 +10: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
c1c7ea8959 DEV: Change hide_email_address_taken default to true (#30293)
We're changing the default of hide_email_address_taken to true. This is a trade-off we want to make, as it prevents account enumeration with minimal impact on legitimate users. If you forget you have an account and try to sign up again with the same e-mail you'll receive an e-mail letting you know.
2024-12-17 10:46:04 +08:00
41df705188 DEV: replaces topic-notifications-options by DMenu (#30298)
This commit introduces <NotificationsTracking /> which is a wrapper component around <DMenu /> which replaces the select-kit component <TopicNotificationsButton />.

Each tracking case has its dedicated component:

- topic -> `<TopicNotificationsTracking />`
- group -> `<GroupNotificationsTracking />`
- tag -> `<TagNotificationsTracking />`
- category -> `<CategoryNotificationsTracking />`
- chat thread -> `<ThreadNotificationsTracking />`
2024-12-16 19:59:18 +01:00
537f09912e DEV: Memoize group find when adding users to groups (#30296) 2024-12-16 17:47:24 +08:00
622eb9e51c FIX: Avoid zipping when adding users to groups (#30263) 2024-12-13 17:24:40 +08: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
a52b83333e DEV: Correctly lint bundled plugins admin directory (#29999) 2024-12-02 16:31:21 +00:00