Skip to content

Commit

Permalink
CV2-4696: ignore payload text (#1945)
Browse files Browse the repository at this point in the history
  • Loading branch information
melsawy authored Jul 6, 2024
1 parent 5d16661 commit 9e4c452
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions app/models/concerns/smooch_messages.rb
Original file line number Diff line number Diff line change
Expand Up @@ -290,11 +290,9 @@ def bundle_list_of_messages_to_items(list, last)
list.collect{ |m| JSON.parse(m) }.sort_by{ |m| m['received'].to_f }.each do |message|
if message['type'] == 'text'
# Get an item for long text (message that match number of words condition)
if message['payload'].nil? && ::Bot::Alegre.get_number_of_words(message['text'].to_s) > CheckConfig.get('min_number_of_words_for_tipline_submit_shortcut', 10, :integer)
messages << message
if message['payload'].nil?
messages << message if ::Bot::Alegre.get_number_of_words(message['text'].to_s) > CheckConfig.get('min_number_of_words_for_tipline_submit_shortcut', 10, :integer)
text << message['text']
else
text << begin JSON.parse(message['payload'])['keyword'] rescue message['text'] end
end
else
# Get an item for each media file
Expand Down

0 comments on commit 9e4c452

Please sign in to comment.