Merge pull request #3211 from techAPJ/patch-1
Improve auto generated email reply error message
This commit is contained in:
commit
722c43b912
|
@ -49,6 +49,8 @@ module Jobs
|
||||||
message_template = :email_reject_topic_not_found
|
message_template = :email_reject_topic_not_found
|
||||||
when Email::Receiver::TopicClosedError
|
when Email::Receiver::TopicClosedError
|
||||||
message_template = :email_reject_topic_closed
|
message_template = :email_reject_topic_closed
|
||||||
|
when Email::Receiver::AutoGeneratedEmailError
|
||||||
|
message_template = :email_reject_auto_generated
|
||||||
when ActiveRecord::Rollback
|
when ActiveRecord::Rollback
|
||||||
message_template = :email_reject_post_error
|
message_template = :email_reject_post_error
|
||||||
when Email::Receiver::InvalidPost
|
when Email::Receiver::InvalidPost
|
||||||
|
|
|
@ -1665,6 +1665,13 @@ en:
|
||||||
|
|
||||||
The topic is closed. If you believe this is in error, contact a staff member.
|
The topic is closed. If you believe this is in error, contact a staff member.
|
||||||
|
|
||||||
|
email_reject_auto_generated:
|
||||||
|
subject_template: "Email issue -- Auto Generated Reply"
|
||||||
|
text_body_template: |
|
||||||
|
We're sorry, but your email message to %{destination} (titled %{former_title}) didn't work.
|
||||||
|
|
||||||
|
Your email reply was auto generated, which we don't accept. If you believe this is in error, contact a staff member.
|
||||||
|
|
||||||
email_error_notification:
|
email_error_notification:
|
||||||
subject_template: "Email issue -- POP authentication error"
|
subject_template: "Email issue -- POP authentication error"
|
||||||
text_body_template: |
|
text_body_template: |
|
||||||
|
|
|
@ -17,6 +17,7 @@ module Email
|
||||||
class BadDestinationAddress < ProcessingError; end
|
class BadDestinationAddress < ProcessingError; end
|
||||||
class TopicNotFoundError < ProcessingError; end
|
class TopicNotFoundError < ProcessingError; end
|
||||||
class TopicClosedError < ProcessingError; end
|
class TopicClosedError < ProcessingError; end
|
||||||
|
class AutoGeneratedEmailError < ProcessingError; end
|
||||||
class EmailLogNotFound < ProcessingError; end
|
class EmailLogNotFound < ProcessingError; end
|
||||||
class InvalidPost < ProcessingError; end
|
class InvalidPost < ProcessingError; end
|
||||||
|
|
||||||
|
@ -41,7 +42,7 @@ module Email
|
||||||
end
|
end
|
||||||
|
|
||||||
raise BadDestinationAddress if dest_info[:type] == :invalid
|
raise BadDestinationAddress if dest_info[:type] == :invalid
|
||||||
raise TopicNotFoundError if message.header.to_s =~ /auto-generated/ || message.header.to_s =~ /auto-replied/
|
raise AutoGeneratedEmailError if message.header.to_s =~ /auto-generated/ || message.header.to_s =~ /auto-replied/
|
||||||
|
|
||||||
# TODO get to a state where we can remove this
|
# TODO get to a state where we can remove this
|
||||||
@message = message
|
@message = message
|
||||||
|
|
|
@ -349,8 +349,8 @@ This is a link http://example.com"
|
||||||
describe "auto response email replies should not be accepted" do
|
describe "auto response email replies should not be accepted" do
|
||||||
let!(:reply_key) { '636ca428858779856c226bb145ef4fad' }
|
let!(:reply_key) { '636ca428858779856c226bb145ef4fad' }
|
||||||
let!(:email_raw) { fixture_file("emails/auto_reply.eml") }
|
let!(:email_raw) { fixture_file("emails/auto_reply.eml") }
|
||||||
it "raises a TopicNotFoundError" do
|
it "raises a AutoGeneratedEmailError" do
|
||||||
expect { receiver.process }.to raise_error(Email::Receiver::TopicNotFoundError)
|
expect { receiver.process }.to raise_error(Email::Receiver::AutoGeneratedEmailError)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue