From a8163bf681fb1bf68a4fc58fd5ed9424209302db Mon Sep 17 00:00:00 2001 From: Santiago Palladino Date: Fri, 28 Oct 2016 19:02:59 -0300 Subject: [PATCH 1/2] Include sms number and language in variables selection in flow Allow reading and writing sms_number and language implicit vars in the call flow. This includes external services, write var, or branch steps. --- app/models/project.rb | 2 +- spec/models/project_spec.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/models/project.rb b/app/models/project.rb index 7dd657654..941b05ad5 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -63,7 +63,7 @@ class Project < ActiveRecord::Base after_save :telemetry_track_activity def defined_variables - project_variables.collect(&:name) + project_variables.collect(&:name) + [ImplicitVariables::Language.key, ImplicitVariables::SmsNumber.key] end def update_variables_with variable_names diff --git a/spec/models/project_spec.rb b/spec/models/project_spec.rb index 026e9073e..f74b92559 100644 --- a/spec/models/project_spec.rb +++ b/spec/models/project_spec.rb @@ -109,7 +109,7 @@ 'max_input_length' => 2, 'timeout' => 10 }] - project.reload.defined_variables.should eq(['some_variable', 'foo']) + project.reload.defined_variables.should eq(['some_variable', 'foo', 'language', 'sms_number']) end end From 6d3a3e3fd0bbee7b1ca35565bec122af23b84a03 Mon Sep 17 00:00:00 2001 From: Santiago Palladino Date: Fri, 28 Oct 2016 19:04:06 -0300 Subject: [PATCH 2/2] Include phone number as variable for external step External step setting implementation was hiding the superclass variables list, which included the ReadVariables, which contain the phone number. --- .../steps/external_step_setting.js.coffee | 19 ------------------- 1 file changed, 19 deletions(-) diff --git a/app/assets/javascripts/workflow/steps/external_step_setting.js.coffee b/app/assets/javascripts/workflow/steps/external_step_setting.js.coffee index e5445a87e..1f8b2bcd1 100644 --- a/app/assets/javascripts/workflow/steps/external_step_setting.js.coffee +++ b/app/assets/javascripts/workflow/steps/external_step_setting.js.coffee @@ -15,25 +15,6 @@ onWorkflow -> display_name: @display_name } - content_kinds: () => - return [{text: 'Variable', value: 'variable'}, - {text: 'Step', value: 'step'}, - {text: 'Response', value: 'response'}, - {text: 'Value', value: 'value'}] - - available_variables: () => - workflow.all_variables().sort() - - available_steps: () => - {name: step.name(), value: step.id} for step in workflow.steps() when (step.type() == 'capture') || (step.type() == 'menu') - - available_responses: () => - _.flatten({name: "#{step.name()} - #{variable.display_name}", value: "#{step.id}_#{variable.name}"} for variable in step.response_variables() for step in workflow.steps() when step.response_variables?) - - on_step_removed: (step) => - @step_id(null) if step.id == parseInt(@step_id()) - @response(null) if step.id == parseInt(@response()) # Note that parseInt("123_resp") == "123" - description: () => desc = super() if desc? then "(#{desc})" else null