mirror of
https://github.com/codeninjasllc/discourse.git
synced 2024-11-24 08:09:13 -05:00
Merge pull request #3211 from techAPJ/patch-1
Improve auto generated email reply error message
This commit is contained in:
commit
722c43b912
4 changed files with 13 additions and 3 deletions
|
@ -49,6 +49,8 @@ module Jobs
|
|||
message_template = :email_reject_topic_not_found
|
||||
when Email::Receiver::TopicClosedError
|
||||
message_template = :email_reject_topic_closed
|
||||
when Email::Receiver::AutoGeneratedEmailError
|
||||
message_template = :email_reject_auto_generated
|
||||
when ActiveRecord::Rollback
|
||||
message_template = :email_reject_post_error
|
||||
when Email::Receiver::InvalidPost
|
||||
|
|
|
@ -1665,6 +1665,13 @@ en:
|
|||
|
||||
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:
|
||||
subject_template: "Email issue -- POP authentication error"
|
||||
text_body_template: |
|
||||
|
|
|
@ -17,6 +17,7 @@ module Email
|
|||
class BadDestinationAddress < ProcessingError; end
|
||||
class TopicNotFoundError < ProcessingError; end
|
||||
class TopicClosedError < ProcessingError; end
|
||||
class AutoGeneratedEmailError < ProcessingError; end
|
||||
class EmailLogNotFound < ProcessingError; end
|
||||
class InvalidPost < ProcessingError; end
|
||||
|
||||
|
@ -41,7 +42,7 @@ module Email
|
|||
end
|
||||
|
||||
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
|
||||
@message = message
|
||||
|
|
|
@ -349,8 +349,8 @@ This is a link http://example.com"
|
|||
describe "auto response email replies should not be accepted" do
|
||||
let!(:reply_key) { '636ca428858779856c226bb145ef4fad' }
|
||||
let!(:email_raw) { fixture_file("emails/auto_reply.eml") }
|
||||
it "raises a TopicNotFoundError" do
|
||||
expect { receiver.process }.to raise_error(Email::Receiver::TopicNotFoundError)
|
||||
it "raises a AutoGeneratedEmailError" do
|
||||
expect { receiver.process }.to raise_error(Email::Receiver::AutoGeneratedEmailError)
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in a new issue