@Override
public PreRenderedMailNotificationQueueItem create(ContentEntityObject contentEntityObject, ConfluenceUser recipient, ConfluenceUser sender, String templateLocation, String templateName, String subject, NotificationContext context) {
PreRenderedMailNotificationQueueItem.Builder builder = PreRenderedMailNotificationQueueItem.with(recipient, templateName, subject).andSender(sender)
.andTemplateLocation(templateLocation).andContext(context.getMap());
Maybe<PluginDataSourceFactory> pluginFactory = imageDataSourceFactory.forPlugin("com.atlassian.confluence.plugins.confluence-mentions-plugin");
if (pluginFactory.isDefined()) {
Maybe<DataSource> mention_icon = pluginFactory.get().resourceFromModuleByName("mention-icon", "mention-icon");
if (mention_icon.isDefined()) {
context.addTemplateImage(mention_icon.get());
}
}
String mentionExcerpt = (String) context.get("contentHtml");
for (DataSource resource : InlineTasksUtils.getRequiredResources(imageDataSourceFactory, mentionExcerpt)) {
context.addTemplateImage(resource);
}
builder.andRelatedBodyParts(context.getTemplateImageDataSources()).andRelatedBodyParts(imagesUsedByChromeTemplate());
return builder.render();
}