Skip to content

Commit

Permalink
Merge branch 'develop' into CV2-4095-shared-feed-cluster-data-model-a…
Browse files Browse the repository at this point in the history
…pi-backend
  • Loading branch information
melsawy committed Feb 15, 2024
2 parents 19942db + d14074e commit 2d21f16
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion app/models/bot/smooch.rb
Original file line number Diff line number Diff line change
Expand Up @@ -494,7 +494,7 @@ def self.process_menu_option_value_for_state(value, message, language, workflow,
new_state = value.gsub(/_state$/, '')
self.delay_for(self.time_to_send_request, { queue: 'smooch', retry: false }).bundle_messages(uid, message['_id'], app_id) if new_state == 'query' && !self.is_v2?
sm.send("go_to_#{new_state}")
self.delay_for(1.seconds, { queue: 'smooch_priority', retry: false }).search(app_id, uid, language, message, self.config['team_id'].to_i, workflow) if new_state == 'search'
self.delay_for(1.seconds, { queue: 'smooch_priority', retry: false }).search(app_id, uid, language, message, self.config['team_id'].to_i, workflow, RequestStore.store[:smooch_bot_provider]) if new_state == 'search'
self.clear_user_bundled_messages(uid) if new_state == 'main'
new_state == 'main' && self.is_v2? ? self.send_message_to_user_with_main_menu_appended(uid, self.get_string('cancelled', language), workflow, language) : self.send_message_for_state(uid, workflow, new_state, language)
end
Expand Down
3 changes: 2 additions & 1 deletion app/models/concerns/smooch_search.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,12 @@ module SmoochSearch

module ClassMethods
# This method runs in background
def search(app_id, uid, language, message, team_id, workflow)
def search(app_id, uid, language, message, team_id, workflow, provider = nil)
platform = self.get_platform_from_message(message)
begin
sm = CheckStateMachine.new(uid)
self.get_installation(self.installation_setting_id_keys, app_id) if self.config.blank?
RequestStore.store[:smooch_bot_provider] = provider unless provider.blank?
results = self.get_search_results(uid, message, team_id, language).select do |pm|
pm = Relationship.confirmed_parent(pm)
report = pm.get_dynamic_annotation('report_design')
Expand Down

0 comments on commit 2d21f16

Please sign in to comment.