app/controllers/decidim/accountability/admin/statuses_controller.rb in decidim-accountability-0.28.4 vs app/controllers/decidim/accountability/admin/statuses_controller.rb in decidim-accountability-0.29.0.rc1
- old
+ new
@@ -16,11 +16,11 @@
def create
enforce_permission_to :create, :status
@form = form(StatusForm).from_params(params)
- CreateStatus.call(@form, current_user) do
+ CreateStatus.call(@form) do
on(:ok) do
flash[:notice] = I18n.t("statuses.create.success", scope: "decidim.accountability.admin")
redirect_to statuses_path
end
@@ -40,11 +40,11 @@
def update
enforce_permission_to(:update, :status, status:)
@form = form(StatusForm).from_params(params)
- UpdateStatus.call(@form, status, current_user) do
+ UpdateStatus.call(@form, status) do
on(:ok) do
flash[:notice] = I18n.t("statuses.update.success", scope: "decidim.accountability.admin")
redirect_to statuses_path
end
@@ -56,16 +56,15 @@
end
def destroy
enforce_permission_to(:destroy, :status, status:)
- Decidim.traceability.perform_action!("delete", status, current_user) do
- status.destroy!
+ Decidim::Commands::DestroyResource.call(status, current_user) do
+ on(:ok) do
+ flash[:notice] = I18n.t("statuses.destroy.success", scope: "decidim.accountability.admin")
+ redirect_to statuses_path
+ end
end
-
- flash[:notice] = I18n.t("statuses.destroy.success", scope: "decidim.accountability.admin")
-
- redirect_to statuses_path
end
private
def statuses