Skip to content

Commit

Permalink
Process Booking emails grouping key
Browse files Browse the repository at this point in the history
  • Loading branch information
endSly committed Feb 5, 2024
1 parent 0657b44 commit 83a1526
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion app/mailboxes/support_mailbox.rb
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,16 @@ def in_reply_to
mail['In-Reply-To'].try(:value)
end

BOOKING_CHAT_GROUPING = /(\d+)-.+@mchat.booking.com/

def extract_grouping_key
mail['In-Reply-To'].try(:value)
in_reply_to = mail['In-Reply-To'].try(:value)
return unless in_reply_to

m = BOOKING_CHAT_GROUPING.match(in_reply_to)
return m[1] if m

in_reply_to
end

def find_or_create_conversation
Expand Down

0 comments on commit 83a1526

Please sign in to comment.