Add a User Preference to Receive only Plaintext Emails

This change adds backend support for a new user preference that enables
users to specify that they want to receive plaintext emails only.
It also adds tests.

From now on, Gerrit will send out two emails: A multipart version and a
plaintext version if at least one user in the list of recipients has set
this user preference to plaintext.

For users who prefer plaintext, this comes at the cost of not being
listed in the multipart To and Cc headers. We work around this by adding
all users to the Reply-To address in both the plaintext and multipart
email.

The frontend work is done in a separate change.

Feature: Issue 5349
Change-Id: I190644732245cb4307f2ef098de173f3cc6209f2
This commit is contained in:
Patrick Hiesel
2017-02-27 16:24:26 +01:00
parent 8d30fa20dd
commit b5e5869409
9 changed files with 169 additions and 28 deletions

View File

@@ -1004,10 +1004,10 @@ public abstract class AbstractDaemonTest {
grant(Permission.CREATE_SIGNED_TAG, project, R_TAGS + "*");
}
protected void assertMailFrom(Message message, String email) throws Exception {
protected void assertMailReplyTo(Message message, String email) throws Exception {
assertThat(message.headers()).containsKey("Reply-To");
EmailHeader.String replyTo = (EmailHeader.String) message.headers().get("Reply-To");
assertThat(replyTo.getString()).isEqualTo(email);
assertThat(replyTo.getString()).contains(email);
}
protected ContributorAgreement configureContributorAgreement(boolean autoVerify)