FIX: create an automation with forced_triggerable enabled (#29030)

When trying to create a new automation based on a scriptable that has "force_triggerable" enable, it would break because of a typo in the code.

This fixes the typo and add a spec to ensure this code path is tested.
This commit is contained in:
Régis Hanol
2024-09-30 17:42:00 +02:00
committed by GitHub
parent edcc581d43
commit 252dcfbfa6
2 changed files with 43 additions and 1 deletions

View File

@ -29,7 +29,7 @@ module DiscourseAutomation
)
if automation.scriptable&.forced_triggerable
automation.trigger = scriptable.forced_triggerable[:triggerable].to_s
automation.trigger = automation.scriptable.forced_triggerable[:triggerable].to_s
end
automation.save!