mirror of
https://github.com/anteo/redmine_custom_workflows.git
synced 2026-01-26 00:04:20 +00:00
When using Before Destruction on issues, no error gets displayed #275
This commit is contained in:
parent
492dd4e9ba
commit
607b614c8c
@ -56,7 +56,10 @@ module RedmineCustomWorkflows
|
||||
end
|
||||
|
||||
def before_destroy_custom_workflows
|
||||
CustomWorkflow.run_custom_workflows :attachment, self, :before_destroy
|
||||
res = CustomWorkflow.run_custom_workflows :attachment, self, :before_destroy
|
||||
if res == false
|
||||
throw :abort
|
||||
end
|
||||
end
|
||||
|
||||
def after_destroy_custom_workflows
|
||||
|
||||
@ -70,7 +70,10 @@ module RedmineCustomWorkflows
|
||||
end
|
||||
|
||||
def before_destroy_custom_workflows
|
||||
CustomWorkflow.run_custom_workflows :group, self, :before_destroy
|
||||
res = CustomWorkflow.run_custom_workflows :group, self, :before_destroy
|
||||
if res == false
|
||||
throw :abort
|
||||
end
|
||||
end
|
||||
|
||||
def after_destroy_custom_workflows
|
||||
|
||||
@ -84,7 +84,7 @@ module RedmineCustomWorkflows
|
||||
|
||||
def before_destroy_custom_workflows
|
||||
res = CustomWorkflow.run_custom_workflows(:issue, self, :before_destroy)
|
||||
if res === false
|
||||
if res == false
|
||||
throw :abort
|
||||
end
|
||||
end
|
||||
|
||||
@ -77,7 +77,10 @@ module RedmineCustomWorkflows
|
||||
end
|
||||
|
||||
def before_destroy_custom_workflows
|
||||
CustomWorkflow.run_custom_workflows :issue_relation, self, :before_destroy
|
||||
res = CustomWorkflow.run_custom_workflows :issue_relation, self, :before_destroy
|
||||
if res == false
|
||||
throw :abort
|
||||
end
|
||||
end
|
||||
|
||||
def after_destroy_custom_workflows
|
||||
|
||||
@ -71,7 +71,10 @@ module RedmineCustomWorkflows
|
||||
end
|
||||
|
||||
def before_destroy_custom_workflows
|
||||
CustomWorkflow.run_custom_workflows :project, self, :before_destroy
|
||||
res = CustomWorkflow.run_custom_workflows :project, self, :before_destroy
|
||||
if res == false
|
||||
throw :abort
|
||||
end
|
||||
end
|
||||
|
||||
def after_destroy_custom_workflows
|
||||
|
||||
@ -56,7 +56,10 @@ module RedmineCustomWorkflows
|
||||
end
|
||||
|
||||
def before_destroy_custom_workflows
|
||||
CustomWorkflow.run_custom_workflows :time_entry, self, :before_destroy
|
||||
res = CustomWorkflow.run_custom_workflows :time_entry, self, :before_destroy
|
||||
if res == false
|
||||
throw :abort
|
||||
end
|
||||
end
|
||||
|
||||
def after_destroy_custom_workflows
|
||||
|
||||
@ -56,7 +56,10 @@ module RedmineCustomWorkflows
|
||||
end
|
||||
|
||||
def before_destroy_custom_workflows
|
||||
CustomWorkflow.run_custom_workflows :user, self, :before_destroy
|
||||
res = CustomWorkflow.run_custom_workflows :user, self, :before_destroy
|
||||
if res == false
|
||||
throw :abort
|
||||
end
|
||||
end
|
||||
|
||||
def after_destroy_custom_workflows
|
||||
|
||||
@ -56,7 +56,10 @@ module RedmineCustomWorkflows
|
||||
end
|
||||
|
||||
def before_destroy_custom_workflows
|
||||
CustomWorkflow.run_custom_workflows :version, self, :before_destroy
|
||||
res = CustomWorkflow.run_custom_workflows :version, self, :before_destroy
|
||||
if res == false
|
||||
throw :abort
|
||||
end
|
||||
end
|
||||
|
||||
def after_destroy_custom_workflows
|
||||
|
||||
@ -56,7 +56,10 @@ module RedmineCustomWorkflows
|
||||
end
|
||||
|
||||
def before_destroy_custom_workflows
|
||||
CustomWorkflow.run_custom_workflows :wiki_content, self, :before_destroy
|
||||
res = CustomWorkflow.run_custom_workflows :wiki_content, self, :before_destroy
|
||||
if res == false
|
||||
throw :abort
|
||||
end
|
||||
end
|
||||
|
||||
def after_destroy_custom_workflows
|
||||
|
||||
3
test/fixtures/custom_workflows.yml
vendored
3
test/fixtures/custom_workflows.yml
vendored
@ -17,7 +17,8 @@ custom_workflows_001:
|
||||
after_add: NULL
|
||||
before_remove: NULL
|
||||
after_remove: NULL
|
||||
before_destroy: ''
|
||||
before_destroy: "self.custom_workflow_messages[:error] = 'Issue cannot be deleted'\n
|
||||
return false"
|
||||
after_destroy : ''
|
||||
|
||||
custom_workflows_002:
|
||||
|
||||
@ -40,4 +40,11 @@ class IssuesControllerPatchTest < RedmineCustomWorkflows::Test::TestCase
|
||||
assert_equal 'Custom workflow', @controller.flash[:notice]
|
||||
end
|
||||
|
||||
def test_delete_with_cw
|
||||
delete :destroy, params: { id: @issue1.id, todo: 'destroy' }
|
||||
assert_response :redirect
|
||||
assert_equal 'Issue cannot be deleted', @controller.flash[:error]
|
||||
assert Issue.find_by(id: @issue1.id)
|
||||
end
|
||||
|
||||
end
|
||||
Loading…
x
Reference in New Issue
Block a user