mirror of
https://github.com/discourse/discourse.git
synced 2025-06-01 05:53:52 +08:00
FIX: use MD5 of the email_string when there's no 'Message-Id'
This commit is contained in:
@ -21,14 +21,6 @@ describe Email::Receiver do
|
||||
expect { Email::Receiver.new("") }.to raise_error(Email::Receiver::EmptyEmailError)
|
||||
end
|
||||
|
||||
it "raises an NoMessageIdError when 'mail_string' is not an email" do
|
||||
expect { Email::Receiver.new("wat") }.to raise_error(Email::Receiver::NoMessageIdError)
|
||||
end
|
||||
|
||||
it "raises an NoMessageIdError when 'mail_string' is missing the message_id" do
|
||||
expect { Email::Receiver.new(email(:missing_message_id)) }.to raise_error(Email::Receiver::NoMessageIdError)
|
||||
end
|
||||
|
||||
it "raises an AutoGeneratedEmailError when the mail is auto generated" do
|
||||
expect { process(:auto_generated_precedence) }.to raise_error(Email::Receiver::AutoGeneratedEmailError)
|
||||
expect { process(:auto_generated_header) }.to raise_error(Email::Receiver::AutoGeneratedEmailError)
|
||||
@ -65,6 +57,12 @@ describe Email::Receiver do
|
||||
let(:post) { create_post(topic: topic, user: user) }
|
||||
let!(:email_log) { Fabricate(:email_log, reply_key: reply_key, user: user, topic: topic, post: post) }
|
||||
|
||||
it "uses MD5 of 'mail_string' there is no message_id" do
|
||||
mail_string = email(:missing_message_id)
|
||||
expect { Email::Receiver.new(mail_string).process! }.to change { IncomingEmail.count }
|
||||
expect(IncomingEmail.last.message_id).to eq(Digest::MD5.hexdigest(mail_string))
|
||||
end
|
||||
|
||||
it "raises a ReplyUserNotMatchingError when the email address isn't matching the one we sent the notification to" do
|
||||
expect { process(:reply_user_not_matching) }.to raise_error(Email::Receiver::ReplyUserNotMatchingError)
|
||||
end
|
||||
|
Reference in New Issue
Block a user