A `UserHistory` entry will now be created when an automation is destroyed. This is visible in `/admin/logs/staff_action_logs`. id, name, trigger and script will be logged.
This commit also creates a service `DestroyAutomation` to hold all the destroy automation logic.
---------
Co-authored-by: Martin Brennan <mjrbrennan@gmail.com>
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.
When adding custom translations for tests using `I18n.backend.store_translations`,
we need to remove the custom translations at the end of each test to
prevent the custom translations from leaking to other tests.