Skip to content

Commit b7ffed1

Browse files
committedJul 30, 2022
Postmark sends MailboxHash as all lowercase
1 parent 26a4ac4 commit b7ffed1

File tree

3 files changed

+6
-2
lines changed

3 files changed

+6
-2
lines changed
 

‎app/jobs/inbound_email_job.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ def send_message(message, email:)
2828
end
2929

3030
def conversation
31-
@conversation ||= user.conversations.find_by!(inbound_email_token: conversation_token)
31+
@conversation ||= user.conversations.find_by_inbound_email_token!(conversation_token)
3232
end
3333

3434
def user

‎app/models/conversation.rb

+4
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@ class Conversation < ApplicationRecord
1313
scope :blocked, -> { where.not(developer_blocked_at: nil).or(Conversation.where.not(business_blocked_at: nil)) }
1414
scope :visible, -> { where(developer_blocked_at: nil, business_blocked_at: nil) }
1515

16+
def self.find_by_inbound_email_token!(token)
17+
where("lower(inbound_email_token) = ?", token).first!
18+
end
19+
1620
def other_recipient(user)
1721
developer == user.developer ? business : developer
1822
end

‎test/jobs/inbound_email_job_test.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ def payload(id: "7ca91d0d-cf10", from_email: users(:prospect_developer).email)
7474
"Email" => from_email
7575
},
7676
"MessageID" => id,
77-
"MailboxHash" => conversations(:one).inbound_email_token,
77+
"MailboxHash" => conversations(:one).inbound_email_token.downcase,
7878
"StrippedTextReply" => "A reply via email."
7979
}
8080
end

0 commit comments

Comments
 (0)