Add extension point that allows plugins to register soy templates for sending emails

Plugins want to use the existing mail infrastructure for sending custom
emails. If the plugin can register soy templates, the plugin can easily
extend one of the existing sender class (e.g. ReplyToChangeSender) to
send custom emails with these custom soy templates.

Signed-off-by: Edwin Kempin <ekempin@google.com>
Change-Id: Ic3adcbb73ed3f82395da4f273bc9fc856a50a257
This commit is contained in:
Edwin Kempin
2019-09-26 11:50:03 +02:00
parent e49c518e2c
commit 7c9aa3e453
4 changed files with 67 additions and 5 deletions

View File

@@ -150,6 +150,7 @@ import com.google.gerrit.server.mail.send.FromAddressGenerator;
import com.google.gerrit.server.mail.send.FromAddressGeneratorProvider;
import com.google.gerrit.server.mail.send.InboundEmailRejectionSender;
import com.google.gerrit.server.mail.send.MailSoySauceProvider;
import com.google.gerrit.server.mail.send.MailSoyTemplateProvider;
import com.google.gerrit.server.mail.send.MailTemplates;
import com.google.gerrit.server.mime.FileTypeRegistry;
import com.google.gerrit.server.mime.MimeUtilFileTypeRegistry;
@@ -392,6 +393,7 @@ public class GerritGlobalModule extends FactoryModule {
DynamicSet.bind(binder(), RequestListener.class).to(TraceRequestListener.class);
DynamicSet.setOf(binder(), ChangeETagComputation.class);
DynamicSet.setOf(binder(), ExceptionHook.class);
DynamicSet.setOf(binder(), MailSoyTemplateProvider.class);
DynamicMap.mapOf(binder(), MailFilter.class);
bind(MailFilter.class).annotatedWith(Exports.named("ListMailFilter")).to(ListMailFilter.class);