diff --git a/app/models/custom_workflow.rb b/app/models/custom_workflow.rb index d36622d..32db375 100644 --- a/app/models/custom_workflow.rb +++ b/app/models/custom_workflow.rb @@ -116,7 +116,7 @@ class CustomWorkflow < ActiveRecord::Base object.instance_eval(read_attribute(event)) if respond_to?(event) && read_attribute(event) rescue WorkflowError => _ rescue Exception => e - errors.add event, :invalid_script, :errors => e + errors.add event, :invalid_script, error: e end def validate_scripts_presence diff --git a/lib/redmine_custom_workflows/patches/attachment_patch.rb b/lib/redmine_custom_workflows/patches/attachment_patch.rb index c4e4bfe..85f4fa2 100644 --- a/lib/redmine_custom_workflows/patches/attachment_patch.rb +++ b/lib/redmine_custom_workflows/patches/attachment_patch.rb @@ -40,6 +40,7 @@ module RedmineCustomWorkflows @saved_attributes = attributes.dup CustomWorkflow.run_shared_code(self) CustomWorkflow.run_custom_workflows(:attachment, self, :before_save) + throw :abort if errors.any? errors.empty? && (@saved_attributes == attributes || valid?) ensure @saved_attributes = nil diff --git a/lib/redmine_custom_workflows/patches/group_patch.rb b/lib/redmine_custom_workflows/patches/group_patch.rb index a3f4bb4..ca3e8f6 100644 --- a/lib/redmine_custom_workflows/patches/group_patch.rb +++ b/lib/redmine_custom_workflows/patches/group_patch.rb @@ -54,6 +54,7 @@ module RedmineCustomWorkflows @saved_attributes = attributes.dup CustomWorkflow.run_shared_code(self) CustomWorkflow.run_custom_workflows(:group, self, :before_save) + throw :abort if errors.any? errors.empty? && (@saved_attributes == attributes || valid?) ensure @saved_attributes = nil diff --git a/lib/redmine_custom_workflows/patches/issue_patch.rb b/lib/redmine_custom_workflows/patches/issue_patch.rb index 8e5f257..be0f9ae 100644 --- a/lib/redmine_custom_workflows/patches/issue_patch.rb +++ b/lib/redmine_custom_workflows/patches/issue_patch.rb @@ -68,6 +68,7 @@ module RedmineCustomWorkflows @saved_attributes = attributes.dup CustomWorkflow.run_shared_code(self) CustomWorkflow.run_custom_workflows(:issue, self, :before_save) + throw :abort if errors.any? errors.empty? && (@saved_attributes == attributes || valid?) ensure @saved_attributes = nil diff --git a/lib/redmine_custom_workflows/patches/project_patch.rb b/lib/redmine_custom_workflows/patches/project_patch.rb index 3153fe2..22948ee 100644 --- a/lib/redmine_custom_workflows/patches/project_patch.rb +++ b/lib/redmine_custom_workflows/patches/project_patch.rb @@ -59,6 +59,7 @@ module RedmineCustomWorkflows @saved_attributes = attributes.dup CustomWorkflow.run_shared_code(self) CustomWorkflow.run_custom_workflows(:project, self, :before_save) + throw :abort if errors.any? errors.empty? && (@saved_attributes == attributes || valid?) ensure @saved_attributes = nil diff --git a/lib/redmine_custom_workflows/patches/time_entry_patch.rb b/lib/redmine_custom_workflows/patches/time_entry_patch.rb index 670a4da..e060caf 100644 --- a/lib/redmine_custom_workflows/patches/time_entry_patch.rb +++ b/lib/redmine_custom_workflows/patches/time_entry_patch.rb @@ -40,6 +40,7 @@ module RedmineCustomWorkflows @saved_attributes = attributes.dup CustomWorkflow.run_shared_code(self) CustomWorkflow.run_custom_workflows(:time_entry, self, :before_save) + throw :abort if errors.any? errors.empty? && (@saved_attributes == attributes || valid?) ensure @saved_attributes = nil diff --git a/lib/redmine_custom_workflows/patches/user_patch.rb b/lib/redmine_custom_workflows/patches/user_patch.rb index 749cf7e..8092029 100644 --- a/lib/redmine_custom_workflows/patches/user_patch.rb +++ b/lib/redmine_custom_workflows/patches/user_patch.rb @@ -40,6 +40,7 @@ module RedmineCustomWorkflows @saved_attributes = attributes.dup CustomWorkflow.run_shared_code(self) CustomWorkflow.run_custom_workflows(:user, self, :before_save) + throw :abort if errors.any? errors.empty? && (@saved_attributes == attributes || valid?) ensure @saved_attributes = nil diff --git a/lib/redmine_custom_workflows/patches/version_patch.rb b/lib/redmine_custom_workflows/patches/version_patch.rb index f05d86e..743c92a 100644 --- a/lib/redmine_custom_workflows/patches/version_patch.rb +++ b/lib/redmine_custom_workflows/patches/version_patch.rb @@ -40,6 +40,7 @@ module RedmineCustomWorkflows @saved_attributes = attributes.dup CustomWorkflow.run_shared_code(self) CustomWorkflow.run_custom_workflows(:version, self, :before_save) + throw :abort if errors.any? errors.empty? && (@saved_attributes == attributes || valid?) ensure @saved_attributes = nil diff --git a/lib/redmine_custom_workflows/patches/wiki_content_patch.rb b/lib/redmine_custom_workflows/patches/wiki_content_patch.rb index dd431e5..0230032 100644 --- a/lib/redmine_custom_workflows/patches/wiki_content_patch.rb +++ b/lib/redmine_custom_workflows/patches/wiki_content_patch.rb @@ -40,6 +40,7 @@ module RedmineCustomWorkflows @saved_attributes = attributes.dup CustomWorkflow.run_shared_code(self) CustomWorkflow.run_custom_workflows(:wiki_content, self, :before_save) + throw :abort if errors.any? errors.empty? && (@saved_attributes == attributes || valid?) ensure @saved_attributes = nil