mirror of
https://github.com/gitbucket/gitbucket.git
synced 2025-11-07 22:15:51 +01:00
Fix bug.
This commit is contained in:
@@ -9,6 +9,7 @@ import app.Context
|
|||||||
import service.{AccountService, RepositoryService, IssuesService, SystemSettingsService}
|
import service.{AccountService, RepositoryService, IssuesService, SystemSettingsService}
|
||||||
import servlet.Database
|
import servlet.Database
|
||||||
import SystemSettingsService.Smtp
|
import SystemSettingsService.Smtp
|
||||||
|
import _root_.util.ControlUtil.defining
|
||||||
|
|
||||||
trait Notifier extends RepositoryService with AccountService with IssuesService {
|
trait Notifier extends RepositoryService with AccountService with IssuesService {
|
||||||
def toNotify(r: RepositoryService.RepositoryInfo, issueId: Int, content: String)
|
def toNotify(r: RepositoryService.RepositoryInfo, issueId: Int, content: String)
|
||||||
@@ -68,6 +69,13 @@ class Mailer(private val smtp: Smtp) extends Notifier {
|
|||||||
val database = Database(context.request.getServletContext)
|
val database = Database(context.request.getServletContext)
|
||||||
|
|
||||||
val f = future {
|
val f = future {
|
||||||
|
// TODO Can we use the Database Session in other than Transaction Filter?
|
||||||
|
database withSession {
|
||||||
|
getIssue(r.owner, r.name, issueId.toString) foreach { issue =>
|
||||||
|
defining(
|
||||||
|
s"[${r.name}] ${issue.title} (#${issueId})" ->
|
||||||
|
msg(view.Markdown.toHtml(content, r, false, true))) { case (subject, msg) =>
|
||||||
|
recipients(issue) {
|
||||||
val email = new HtmlEmail
|
val email = new HtmlEmail
|
||||||
email.setHostName(smtp.host)
|
email.setHostName(smtp.host)
|
||||||
email.setSmtpPort(smtp.port.get)
|
email.setSmtpPort(smtp.port.get)
|
||||||
@@ -83,18 +91,14 @@ class Mailer(private val smtp: Smtp) extends Notifier {
|
|||||||
.foreach { case (address, name) =>
|
.foreach { case (address, name) =>
|
||||||
email.setFrom(address, name)
|
email.setFrom(address, name)
|
||||||
}
|
}
|
||||||
email.setHtmlMsg(msg(view.Markdown.toHtml(content, r, false, true)))
|
email.setSubject(subject)
|
||||||
|
email.setHtmlMsg(msg)
|
||||||
|
|
||||||
// TODO Can we use the Database Session in other than Transaction Filter?
|
|
||||||
database withSession {
|
|
||||||
getIssue(r.owner, r.name, issueId.toString) foreach { issue =>
|
|
||||||
email.setSubject(s"[${r.name}] ${issue.title} (#${issueId})")
|
|
||||||
recipients(issue) {
|
|
||||||
email.getToAddresses.clear
|
|
||||||
email.addTo(_).send
|
email.addTo(_).send
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
"Notifications Successful."
|
"Notifications Successful."
|
||||||
}
|
}
|
||||||
f onSuccess {
|
f onSuccess {
|
||||||
|
|||||||
Reference in New Issue
Block a user