forked from lichess-org/lila
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Notifier.scala
30 lines (23 loc) · 777 Bytes
/
Notifier.scala
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
package lila.team
import lila.hub.actorApi.message.LichessThread
import lila.hub.actorApi.router._
import akka.actor.ActorRef
import akka.pattern.ask
import play.api.libs.concurrent.Execution.Implicits._
private[team] final class Notifier(
messenger: ActorRef,
router: ActorRef) {
import makeTimeout.large
def acceptRequest(team: Team, request: Request) {
teamUrl(team.id) foreach { url ⇒
messenger ! LichessThread(
to = request.user,
subject = """You have joined the team %s""".format(team.name),
message = """Congratulation, your request to join the team was accepted!
Here is the team page: %s""" format url
)
}
}
private def teamUrl(id: String) =
router ? Abs(TeamShow(id)) mapTo manifest[String]
}