discourse/plugins/automation/config/routes.rb
Joffrey JAFFEUX 932bd6ba85
Some checks are pending
Licenses / run (push) Waiting to run
Linting / run (push) Waiting to run
Tests / ${{ matrix.target }} ${{ matrix.build_type }} (frontend, themes) (push) Waiting to run
Tests / ${{ matrix.target }} ${{ matrix.build_type }} (system, chat) (push) Waiting to run
Tests / ${{ matrix.target }} ${{ matrix.build_type }} (system, core) (push) Waiting to run
Tests / ${{ matrix.target }} ${{ matrix.build_type }} (system, plugins) (push) Waiting to run
Tests / ${{ matrix.target }} ${{ matrix.build_type }} (system, themes) (push) Waiting to run
Tests / core frontend (${{ matrix.browser }}) (Chrome) (push) Waiting to run
Tests / core frontend (${{ matrix.browser }}) (Firefox ESR) (push) Waiting to run
Tests / core frontend (${{ matrix.browser }}) (Firefox Evergreen) (push) Waiting to run
Tests / ${{ matrix.target }} ${{ matrix.build_type }} (annotations, core) (push) Waiting to run
Tests / ${{ matrix.target }} ${{ matrix.build_type }} (backend, core) (push) Waiting to run
Tests / ${{ matrix.target }} ${{ matrix.build_type }} (backend, plugins) (push) Waiting to run
Tests / ${{ matrix.target }} ${{ matrix.build_type }} (frontend, plugins) (push) Waiting to run
UX: logs when an automation is destroyed (#29565)
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>
2024-11-04 11:12:18 +09:00

35 lines
1.2 KiB
Ruby

# frozen_string_literal: true
DiscourseAutomation::Engine.routes.draw do
scope format: :json, constraints: AdminConstraint.new do
post "/automations/:id/trigger" => "automations#trigger"
end
scope format: :json do
delete "/user-global-notices/:id" => "user_global_notices#destroy"
put "/append-last-checked-by/:post_id" => "append_last_checked_by#post_checked"
end
scope "/admin/plugins/discourse-automation",
as: "admin_discourse_automation",
constraints: AdminConstraint.new do
scope format: false do
get "/" => "admin#index"
get "/new" => "admin#new"
get "/:id" => "admin#edit"
end
scope format: :json do
get "/scriptables" => "admin_scriptables#index"
get "/triggerables" => "admin_triggerables#index"
get "/automations" => "admin_automations#index"
get "/automations/:id" => "admin_automations#show"
delete "/automations/:automation_id" => "admin_automations#destroy"
put "/automations/:id" => "admin_automations#update"
post "/automations" => "admin_automations#create"
end
end
end
Discourse::Application.routes.draw { mount ::DiscourseAutomation::Engine, at: "/" }