mirror of
https://github.com/gitbucket/gitbucket.git
synced 2025-11-06 21:45:50 +01:00
(refs #100) Fix bug that can't get ServletContext in the future block.
This commit is contained in:
@@ -65,6 +65,8 @@ class Mailer(private val smtp: Smtp) extends Notifier {
|
|||||||
|
|
||||||
def toNotify(r: RepositoryService.RepositoryInfo, issueId: Int, content: String)
|
def toNotify(r: RepositoryService.RepositoryInfo, issueId: Int, content: String)
|
||||||
(msg: String => String)(implicit context: Context) = {
|
(msg: String => String)(implicit context: Context) = {
|
||||||
|
val database = Database(context.request.getServletContext)
|
||||||
|
|
||||||
val f = future {
|
val f = future {
|
||||||
val email = new HtmlEmail
|
val email = new HtmlEmail
|
||||||
email.setHostName(smtp.host)
|
email.setHostName(smtp.host)
|
||||||
@@ -79,7 +81,7 @@ class Mailer(private val smtp: Smtp) extends Notifier {
|
|||||||
email.setHtmlMsg(msg(view.Markdown.toHtml(content, r, false, true)))
|
email.setHtmlMsg(msg(view.Markdown.toHtml(content, r, false, true)))
|
||||||
|
|
||||||
// TODO Can we use the Database Session in other than Transaction Filter?
|
// TODO Can we use the Database Session in other than Transaction Filter?
|
||||||
Database(context.request.getServletContext) withSession {
|
database withSession {
|
||||||
getIssue(r.owner, r.name, issueId.toString) foreach { issue =>
|
getIssue(r.owner, r.name, issueId.toString) foreach { issue =>
|
||||||
email.setSubject(s"[${r.name}] ${issue.title} (#${issueId})")
|
email.setSubject(s"[${r.name}] ${issue.title} (#${issueId})")
|
||||||
recipients(issue) {
|
recipients(issue) {
|
||||||
|
|||||||
Reference in New Issue
Block a user