Send notification emails when inbound emails are rejected
With this commit, explanatory messages are sent when inbound messages are rejected. Four error types are defined: PARSING_ERROR, INACTIVE_ACCOUNT, UNKNOWN_ACCOUNT, and INTERNAL_EXCEPTION. PARSING_ERROR (probably the most frequent one) occurs when the Gerrit metadatas can't be parsed. INACTIVE_ACCOUNT occurs when the user's account is Inactive. UNKNOWN_ACCOUNT occurs when zero or more than one accounts are found for the incoming email address. This might be caused by multiple sources providing the same user. INTERNAL_EXCEPTION is used for all the other exceptions that can't be described properly to the end user. For now, it is only fired when two Changes are found with the same Id. This _should_ be a rare exception, but it might occur. This change also introduces a new MailHeader enum, and removes the old MetadataName one. This allows for a cleaner way to define both Mail headers and Gerrit "internal" metadata names. Feature: Issue 8210 Change-Id: I48a081f2ce1be391b9f3ff991760740d5ada3357
This commit is contained in:
committed by
David Pursehouse
parent
96251c8d71
commit
2a10edcddc
@@ -64,8 +64,5 @@
|
||||
browser window instead.
|
||||
|
||||
{\n}
|
||||
{\n}
|
||||
|
||||
This is a send-only email address. Replies to this message will not be read
|
||||
or answered.
|
||||
{call .NoReplyFooter /}
|
||||
{/template}
|
||||
|
||||
@@ -59,8 +59,5 @@
|
||||
{/if}.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
This is a send-only email address. Replies to this message will not be read
|
||||
or answered.
|
||||
</p>
|
||||
{call .NoReplyFooterHtml /}
|
||||
{/template}
|
||||
|
||||
@@ -0,0 +1,64 @@
|
||||
/**
|
||||
* Copyright (C) 2018 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
{namespace com.google.gerrit.server.mail.template}
|
||||
|
||||
{template .InboundEmailRejectionFooter kind="text"}
|
||||
{\n}
|
||||
{\n}
|
||||
Thus, no actions were taken by Gerrit in response to this email,
|
||||
and you should use the Gerrit website to continue.
|
||||
{\n}
|
||||
This email was sent in response to an email coming from this address.
|
||||
In case you did not send Gerrit an email, feel free to ignore this.
|
||||
{call .NoReplyFooter /}
|
||||
{/template}
|
||||
|
||||
/**
|
||||
* The .InboundEmailRejection templates will determine the contents of the email related
|
||||
* to warning users of error in inbound emails
|
||||
*/
|
||||
|
||||
{template .InboundEmailRejection_PARSING_ERROR kind="text"}
|
||||
Gerrit Code Review was unable to parse your email.{\n}
|
||||
This might be because your email did not quote Gerrit's email,
|
||||
because you are using an unsupported email client,
|
||||
or because of a bug.
|
||||
{call .InboundEmailRejectionFooter /}
|
||||
{/template}
|
||||
|
||||
{template .InboundEmailRejection_UNKNOWN_ACCOUNT kind="text"}
|
||||
Gerrit Code Review was unable to match your email to an account.{\n}
|
||||
This may happen if several accounts are linked to this email address.
|
||||
{call .InboundEmailRejectionFooter /}
|
||||
{/template}
|
||||
|
||||
{template .InboundEmailRejection_INACTIVE_ACCOUNT kind="text"}
|
||||
Your account on this Gerrit Code Review instance is marked as inactive,
|
||||
so your email has been ignored. {\n}
|
||||
If you think this is an error, please contact your Gerrit instance administrator.
|
||||
{\n}{\n}
|
||||
This email was sent in response to an email coming from this address.
|
||||
In case you did not send Gerrit an email, feel free to ignore this.
|
||||
{call .NoReplyFooter /}
|
||||
{/template}
|
||||
|
||||
{template .InboundEmailRejection_INTERNAL_EXCEPTION kind="text"}
|
||||
Gerrit Code Review encountered an internal exception and was unable to fulfil your request.
|
||||
{\n}
|
||||
This might be caused by an ongoing maintenance or a data corruption.
|
||||
{call .InboundEmailRejectionFooter /}
|
||||
{/template}
|
||||
@@ -0,0 +1,80 @@
|
||||
/**
|
||||
* Copyright (C) 2018 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
{namespace com.google.gerrit.server.mail.template}
|
||||
|
||||
|
||||
{template .InboundEmailRejectionFooterHtml}
|
||||
<p>
|
||||
Thus, no actions were taken by Gerrit in response to this email,
|
||||
and you should use the Gerrit website to continue.
|
||||
</p>
|
||||
<p>
|
||||
In case you did not send Gerrit an email, feel free to ignore this.
|
||||
</p>
|
||||
{call .NoReplyFooterHtml /}
|
||||
{/template}
|
||||
|
||||
/**
|
||||
* The .InboundEmailRejection templates will determine the contents of the email related
|
||||
* to warning users of error in inbound emails
|
||||
*/
|
||||
|
||||
{template .InboundEmailRejectionHtml_PARSING_ERROR}
|
||||
<p>
|
||||
Gerrit Code Review was unable to parse your email.
|
||||
</p>
|
||||
<p>
|
||||
This might be because your email did not quote Gerrit's email,
|
||||
because you are using an unsupported email client,
|
||||
or because of a bug.
|
||||
</p>
|
||||
{call .InboundEmailRejectionFooterHtml /}
|
||||
{/template}
|
||||
|
||||
{template .InboundEmailRejectionHtml_UNKNOWN_ACCOUNT}
|
||||
<p>
|
||||
Gerrit Code Review was unable to match your email to an account.
|
||||
</p>
|
||||
<p>
|
||||
This may happen if several accounts are linked to this email address.
|
||||
</p>
|
||||
{call .InboundEmailRejectionFooterHtml /}
|
||||
{/template}
|
||||
|
||||
{template .InboundEmailRejectionHtml_INACTIVE_ACCOUNT}
|
||||
<p>
|
||||
Your account on this Gerrit Code Review instance is marked as inactive,
|
||||
so your email has been ignored.
|
||||
</p>
|
||||
<p>
|
||||
If you think this is an error, please contact your Gerrit instance administrator.
|
||||
</p>
|
||||
<p>
|
||||
In case you did not send Gerrit an email, feel free to ignore this.
|
||||
</p>
|
||||
{call .NoReplyFooter /}
|
||||
{/template}
|
||||
|
||||
{template .InboundEmailRejectionHtml_INTERNAL_EXCEPTION}
|
||||
<p>
|
||||
Gerrit Code Review encountered an internal exception and was unable to fulfil your request.
|
||||
</p>
|
||||
<p>
|
||||
This might be caused by an ongoing maintenance or a data corruption.
|
||||
<p>
|
||||
{call .InboundEmailRejectionFooterHtml /}
|
||||
{/template}
|
||||
23
resources/com/google/gerrit/server/mail/NoReplyFooter.soy
Normal file
23
resources/com/google/gerrit/server/mail/NoReplyFooter.soy
Normal file
@@ -0,0 +1,23 @@
|
||||
/**
|
||||
* Copyright (C) 2018 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
{namespace com.google.gerrit.server.mail.template}
|
||||
|
||||
{template .NoReplyFooter kind="text"}
|
||||
{\n}
|
||||
This is a send-only email address. Replies to this message will not be read
|
||||
or answered.
|
||||
{/template}
|
||||
@@ -0,0 +1,24 @@
|
||||
/**
|
||||
* Copyright (C) 2018 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
{namespace com.google.gerrit.server.mail.template}
|
||||
|
||||
{template .NoReplyFooterHtml}
|
||||
<p>
|
||||
This is a send-only email address. Replies to this message will not be read
|
||||
or answered.
|
||||
</p>
|
||||
{/template}
|
||||
Reference in New Issue
Block a user