From c0b4745d5fadc49d1d3d663715fe0ac8e716696a Mon Sep 17 00:00:00 2001 From: d-m-u Date: Tue, 6 Nov 2018 11:47:01 -0500 Subject: [PATCH] Custom Buttons with dialogs should be running invoke --- app/controllers/api/base_controller/generic.rb | 1 + spec/requests/custom_actions_spec.rb | 3 +++ 2 files changed, 4 insertions(+) diff --git a/app/controllers/api/base_controller/generic.rb b/app/controllers/api/base_controller/generic.rb index 11dcb0c0e0..28686a0076 100644 --- a/app/controllers/api/base_controller/generic.rb +++ b/app/controllers/api/base_controller/generic.rb @@ -193,6 +193,7 @@ def invoke_custom_action(type, resource, action, data) def invoke_custom_action_with_dialog(type, resource, action, data, custom_button) result = begin + custom_button.publish_event(nil, resource) wf_result = submit_custom_action_dialog(resource, custom_button, data) action_result(true, "Invoked custom dialog action #{action} for #{type} id: #{resource.id}", diff --git a/spec/requests/custom_actions_spec.rb b/spec/requests/custom_actions_spec.rb index a1f5e9435c..18992fdd2a 100644 --- a/spec/requests/custom_actions_spec.rb +++ b/spec/requests/custom_actions_spec.rb @@ -581,9 +581,12 @@ def define_custom_button1(resource) it "accept custom actions" do api_basic_authorize + expect(CustomButtonEvent.count).to eq(0) + post api_generic_object_url(nil, @resource), :params => gen_request(@button.name, "key1" => "value1") expect_single_action_result(:success => true, :message => /.*/, :href => api_generic_object_url(nil, @resource)) + expect(CustomButtonEvent.count).to eq(1) end end