Commit Graph
15 Commits
Author SHA1 Message Date
David TaylorandRégis Hanol b7a4eadf74 FEATURE: Introduce set_topic_timer automation script (#36660)
Allows different types of topic-timer to be automatically configured on
topics. It uses the 'post_created_edited' trigger, which provides all
sorts of filtering options including category/author/etc.

<img width="804" height="270" alt="SCR-20251212-mzrg"
src="https://github.com/user-attachments/assets/90cca3f8-1516-4adf-830a-c2f43125795d"
/>

---------

Co-authored-by: Régis Hanol <regis@hanol.fr>
2025-12-23 09:46:52 +00:00
Sam e67d9b5f66 FEATURE: New automation for emailing specific users when a post is flagged (#36580)
This commit adds a new "Email on flagged post" automation which can be configured to send emails to users when a post is flagged. The automation can be configured to trigger only when posts are flagged in certain categories or only when certain tags are present on the post's topic.

The body of the email sent can also be configured with the following placeholders available: 

* topic_url
* topic_title
* post_url
* post_number
* flagger_username
* flagged_username
* flag_type
* category
* tags
* post_excerpt
2025-12-11 10:31:13 +08:00
Gabriel Grubba 6c9ef61520 FIX: Remove nameless uploads from deleted posts (#36484)
Nameless attachments should be removed too,
now `![](upload://key.png)` will be removed from deleted posts, when
using `Remove Upload Markup From Deleted Posts` automation.
2025-12-08 13:51:35 -03:00
Gabriel Grubba 2f78101ce2 FIX: use PostRevisor with Topic context when revising posts from deleted topics (#36168)
Relates to https://github.com/discourse/discourse/pull/36020, we did not
account for posts whose topics have been deleted. In such cases, we need
to provide the Topic context to PostRevisor to avoid errors.
2025-11-21 16:58:10 -03:00
Gabriel GrubbaandPenar Musaraj 1fba925cfb FEATURE: Add automation to remove uploads from deleted posts (#36020)
This PR introduces a new automation script that removes uploads attached
to deleted posts.

Using this automation will add a revision to deleted posts by the System
User, removing the upload or attachment references. This Automation goes
a 1000 by every run and does not re-run on already ran posts

When the automation cleans the posts, uploads will no longer have
reference to the post and on the next time the [clean up uploads
job](https://github.com/discourse/discourse/blob/f413e1b0de8c326a12da29f7a4bfa3a6eed004d1/app/jobs/scheduled/clean_up_uploads.rb#L1-L79)
runs it will permanently removes the uploads.

Example of automation run:

```
 Hey it is a regular post with a link to [Discourse](https://www.discourse.org) 
 and an image: ![logo.png|100x200](upload://gj6GJHlc1Sa5YXuGz549oXBbcFv.png)
 and a file: [small.pdf|attachment](upload://3bWzVVoRhUXxi7tiPenInoebHyX.pdf) (130 Bytes)
```
When the automation has run in this post, this will be the revisioned
version:

```
 Hey it is a regular post with a link to [Discourse](https://www.discourse.org) 
 and an image:
 and a file: 
```

---------

Co-authored-by: Penar Musaraj <pmusaraj@gmail.com>
2025-11-18 14:21:03 -03:00
Sérgio Saquetim 301f27caaa DEV: add shortcut fab!(:variable, :fabricator) to specs (#33577) 2025-07-11 11:16:34 -03:00
Krzysztof Kotlarek 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
Natalie Tay 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
Jarek Radosz a4c2653db8 DEV: Update rubocop-discourse (#30552)
…and autofix the issues
2025-01-04 13:48:21 +01:00
Natalie Tay 622eb9e51c FIX: Avoid zipping when adding users to groups (#30263) 2024-12-13 17:24:40 +08:00
Loïc Guitaut d637bd6519 DEV: Don’t replace Rails logger in specs (#29721)
Instead of replacing the Rails logger in specs, we can instead use
`#broadcast_to` which has been introduced in Rails 7.
2024-11-13 08:47:39 +08:00
Joffrey JAFFEUX 6bdda3cb71 FIX: prevents creating post from impacting the app (#28518)
Create a topic can fail in many different ways and we don't want this to impact the rest of the application, the call will now be wrapped in a begin/rescue block and log an error if it fails.
2024-08-23 15:17:16 +02:00
Osama Sayegh 2f2355b0ad DEV: Convert some files to autoloading and various improvements (#26860) 2024-05-06 23:12:55 +03:00
Osama Sayegh 84b4e4bddf FEATURE: Add 'Create topic' automation script (#26552)
This commit adds a new automation script for creating topics. It's very similar to the existing 'create a post' automation, except that it posts new topics in a specific category and with optional tags.

Internal topic: t/125829.
2024-04-09 04:21:31 +03:00
Osama Sayegh 3d4faf3272 FEATURE: Merge discourse-automation (#26432)
Automation (previously known as discourse-automation) is now a core plugin.
2024-04-03 18:20:43 +03:00