diff --git a/app/models/concerns/smooch_search.rb b/app/models/concerns/smooch_search.rb index 00bbda28c5..8c66f2c1c0 100644 --- a/app/models/concerns/smooch_search.rb +++ b/app/models/concerns/smooch_search.rb @@ -14,7 +14,7 @@ def search(app_id, uid, language, message, team_id, workflow, provider = nil) RequestStore.store[:smooch_bot_provider] = provider unless provider.blank? query = self.get_search_query(uid, message) results = self.get_search_results(uid, query, team_id, language).collect{ |pm| Relationship.confirmed_parent(pm) }.uniq - reports = results.collect{ |pm| pm.get_dynamic_annotation('report_design') }.reject{ |r| r.nil? }.collect{ |r| r.report_design_to_tipline_search_result }.select{ |r| r.should_send_in_language?(language) } + reports = results.select{ |pm| pm.report_status == 'published' }.collect{ |pm| pm.get_dynamic_annotation('report_design') }.reject{ |r| r.nil? }.collect{ |r| r.report_design_to_tipline_search_result }.select{ |r| r.should_send_in_language?(language) } # Extract explainers from matched media if they don't have published fact-checks but they have explainers reports = results.collect{ |pm| pm.explainers.to_a }.flatten.uniq.first(3).map(&:as_tipline_search_result) if !results.empty? && reports.empty?