From 56969472462ceaef6f58f91e8063422bebcbacc2 Mon Sep 17 00:00:00 2001 From: Anton Argirov Date: Thu, 9 Jul 2015 14:23:01 +0600 Subject: [PATCH] Non-active workflows are now not checked for syntax. Now you can import non-valid (for your Redmine instance for example) workflow, make changes to it and then activate. --- app/controllers/custom_workflows_controller.rb | 9 ++++++--- app/models/custom_workflow.rb | 2 +- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/app/controllers/custom_workflows_controller.rb b/app/controllers/custom_workflows_controller.rb index 5346136..592f56a 100644 --- a/app/controllers/custom_workflows_controller.rb +++ b/app/controllers/custom_workflows_controller.rb @@ -66,9 +66,12 @@ class CustomWorkflowsController < ApplicationController def change_status respond_to do |format| - @workflow.update_attributes(:active => params[:active]) - flash[:notice] = l(:notice_successful_status_change) - format.html { redirect_to(custom_workflows_path) } + if @workflow.update_attributes(:active => params[:active]) + flash[:notice] = l(:notice_successful_status_change) + format.html { redirect_to(custom_workflows_path) } + else + format.html { render :action => :edit } + end end end diff --git a/app/models/custom_workflow.rb b/app/models/custom_workflow.rb index ffe99a8..6d7cb7c 100644 --- a/app/models/custom_workflow.rb +++ b/app/models/custom_workflow.rb @@ -107,7 +107,7 @@ class CustomWorkflow < ActiveRecord::Base end def validate_syntax - return unless respond_to? :observable + return unless respond_to?(:observable) && active? case observable when 'shared' CustomWorkflow.run_shared_code(self)