sendFeedbackType(extension, feedback, "broken", user);
}
private void sendFeedbackType(final Extension extension, final Feedback feedback, final String feedbackType, final String user)
{
final UserProfile sender = userManager.getUserProfile(user);
if (sender == null)
{
log.warn("Unable to send feedback from '" + user + "' due to no profile found");
return;
}
String pluginAuthor = extension.getAuthor();
if (pluginAuthor != null && userManager.getUserProfile(pluginAuthor) != null)
{
productAccessor.sendEmail(new EmailOptions()
.toUsername(pluginAuthor)
.subjectTemplate("email/" + feedbackType + "-subject.vm")
.bodyTemplate("email/" + feedbackType + "-body.vm")
.replyToEmail(sender.getEmail())
.context(new HashMap<String, Object>()
{{
put("plugin", extension);
put("sender", sender.getUsername());
put("senderFullName", sender.getFullName());
put("feedback", feedback);
put("nl", "\n");
}}));
}
}