Skip to content

Commit

Permalink
Only published fact-checks should be sent.
Browse files Browse the repository at this point in the history
Fixing a bad merge.

Reference: CV2-4664.
  • Loading branch information
caiosba committed Jul 30, 2024
1 parent 1192dad commit e949d5e
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion app/models/concerns/smooch_search.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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?
Expand Down

0 comments on commit e949d5e

Please sign in to comment.