discourse/plugins/automation/lib
Régis Hanol d4103b8e96
FIX: Prevent automation set_topic_timer from reopening closed topics (#39375)
When the `set_topic_timer` automation script saves a `:close` or
`:silent_close` timer on a topic that is already closed,
`TopicTimer#after_save` treats that state mismatch as the "Open
Temporarily" UI intent and immediately reopens the topic as the system
user.

Example seen on meta: an automation configured to add a 3-day close
timer whenever the `fixed` tag is present and a bug post is edited was
inadvertently reopening already-closed bug topics. Editing such a topic
fired the automation, the `:close` timer was saved, and the topic was
reopened by `system` before a moderator noticed and re-closed it.

Guard `auto_close` and `auto_close_after_last_post` in the script with
an early `next` when `topic.closed?` so the automation no-ops on closed
topics rather than triggering the reopen side-effect.
2026-04-21 15:08:31 +02:00
..
discourse_automation FIX: Prevent automation set_topic_timer from reopening closed topics (#39375) 2026-04-21 15:08:31 +02:00
tasks