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 315d060 commit 7f960b7
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion app/mailboxes/support_mailbox.rb
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,14 @@ def find_conversation_by_in_reply_to
@account.conversations.where("additional_attributes->>'in_reply_to' = ?", in_reply_to).first
end

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

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

m = BOOKING_CHAT_GROUPING.match(mail.from)
"#{m[1]}@mchat.booking.com" if m
end

def find_or_create_conversation
Expand Down

0 comments on commit 7f960b7

Please sign in to comment.