mirror of
https://github.com/discourse/discourse.git
synced 2025-06-05 14:07:30 +08:00
FIX: allow an admin to click on blank errors (#5027)
* FIX: allow an admin to click on blank errors * i18nlize strings * what would a rails master do?
This commit is contained in:
@ -16,7 +16,7 @@ class IncomingEmailDetailsSerializer < ApplicationSerializer
|
||||
EMAIL_RECEIVER_ERROR_PREFIX = "Email::Receiver::".freeze
|
||||
|
||||
def error
|
||||
@error_string
|
||||
@error_string.presence || I18n.t("emails.incoming.unrecognized_error")
|
||||
end
|
||||
|
||||
def error_description
|
||||
|
@ -29,4 +29,8 @@ class IncomingEmailSerializer < ApplicationSerializer
|
||||
object.cc_addresses.split(";")
|
||||
end
|
||||
|
||||
def error
|
||||
@object.error.presence || I18n.t("emails.incoming.unrecognized_error")
|
||||
end
|
||||
|
||||
end
|
||||
|
@ -78,6 +78,7 @@ en:
|
||||
topic_closed_error: "Happens when a reply came in but the related topic has been closed."
|
||||
bounced_email_error: "Email is a bounced email report."
|
||||
screened_email_error: "Happens when the sender's email address was already screened."
|
||||
unrecognized_error: "Unrecognized Error"
|
||||
|
||||
errors: &errors
|
||||
format: ! '%{attribute} %{message}'
|
||||
|
@ -66,9 +66,9 @@ describe Email::Processor do
|
||||
Rails.logger.expects(:error)
|
||||
|
||||
Email::Processor.process!(mail)
|
||||
expect(IncomingEmail.first.error).to eq("boom")
|
||||
expect(IncomingEmail.first.rejection_message).to be_present
|
||||
expect(EmailLog.first.email_type).to eq("email_reject_unrecognized_error")
|
||||
expect(IncomingEmail.last.error).to eq("boom")
|
||||
expect(IncomingEmail.last.rejection_message).to be_present
|
||||
expect(EmailLog.last.email_type).to eq("email_reject_unrecognized_error")
|
||||
end
|
||||
|
||||
it "sends more than one rejection email per day" do
|
||||
|
@ -81,4 +81,22 @@ describe Admin::EmailController do
|
||||
end
|
||||
end
|
||||
|
||||
context '.rejected' do
|
||||
it 'should provide a string for a blank error' do
|
||||
Fabricate(:incoming_email, error: "")
|
||||
xhr :get, :rejected
|
||||
rejected = JSON.parse(response.body)
|
||||
expect(rejected.first['error']).to eq(I18n.t("emails.incoming.unrecognized_error"))
|
||||
end
|
||||
end
|
||||
|
||||
context '.incoming' do
|
||||
it 'should provide a string for a blank error' do
|
||||
incoming_email = Fabricate(:incoming_email, error: "")
|
||||
xhr :get, :incoming, id: incoming_email.id
|
||||
incoming = JSON.parse(response.body)
|
||||
expect(incoming['error']).to eq(I18n.t("emails.incoming.unrecognized_error"))
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
1
spec/fabricators/incoming_email_fabricator.rb
Normal file
1
spec/fabricators/incoming_email_fabricator.rb
Normal file
@ -0,0 +1 @@
|
||||
Fabricator(:incoming_email)
|
Reference in New Issue
Block a user