fetch chat light user at render time - WIP - DOOMED
parent
f2b7fa38d4
commit
4e3240ebc2
|
@ -401,7 +401,7 @@ final class Mod(
|
||||||
Secure(_.ChatTimeout) { _ => _ =>
|
Secure(_.ChatTimeout) { _ => _ =>
|
||||||
implicit val lightUser = env.user.lightUserSync
|
implicit val lightUser = env.user.lightUserSync
|
||||||
JsonOptionOk {
|
JsonOptionOk {
|
||||||
env.chat.api.userChat userModInfo username map2 lila.chat.JsonView.userModInfo
|
env.chat.api.userChat userModInfo username map2 env.chat.json.userModInfo
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -69,7 +69,7 @@ final class Round(
|
||||||
env.api.roundApi.player(pov, tour, apiVersion) zip
|
env.api.roundApi.player(pov, tour, apiVersion) zip
|
||||||
getPlayerChat(pov.game, none) map { case ((_, data), chat) =>
|
getPlayerChat(pov.game, none) map { case ((_, data), chat) =>
|
||||||
Ok {
|
Ok {
|
||||||
data.add("chat", chat.flatMap(_.game).map(c => lila.chat.JsonView(c.chat)))
|
data.add("chat", chat.flatMap(_.game).map(c => env.chat.json(c.chat)))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -208,7 +208,7 @@ final class Round(
|
||||||
chat <- getWatcherChat(pov.game)
|
chat <- getWatcherChat(pov.game)
|
||||||
} yield Ok {
|
} yield Ok {
|
||||||
data
|
data
|
||||||
.add("chat" -> chat.map(c => lila.chat.JsonView(c.chat)))
|
.add("chat" -> chat.map(c => env.chat.json(c.chat)))
|
||||||
.add("analysis" -> analysis.map(a => lila.analyse.JsonView.mobile(pov.game, a)))
|
.add("analysis" -> analysis.map(a => lila.analyse.JsonView.mobile(pov.game, a)))
|
||||||
}
|
}
|
||||||
) map { NoCache(_) }
|
) map { NoCache(_) }
|
||||||
|
|
|
@ -181,7 +181,7 @@ final class Study(
|
||||||
Ok(
|
Ok(
|
||||||
Json.obj(
|
Json.obj(
|
||||||
"study" -> data.study.add("chat" -> chatOpt.map { c =>
|
"study" -> data.study.add("chat" -> chatOpt.map { c =>
|
||||||
lila.chat.JsonView.mobile(
|
env.chat.json.mobile(
|
||||||
chat = c.chat,
|
chat = c.chat,
|
||||||
writeable = ctx.userId.??(sc.study.canChat)
|
writeable = ctx.userId.??(sc.study.canChat)
|
||||||
)
|
)
|
||||||
|
|
|
@ -140,7 +140,7 @@ final class Tournament(
|
||||||
)
|
)
|
||||||
chat <- loadChat(tour, json)
|
chat <- loadChat(tour, json)
|
||||||
} yield Ok(json.add("chat" -> chat.map { c =>
|
} yield Ok(json.add("chat" -> chat.map { c =>
|
||||||
lila.chat.JsonView.mobile(chat = c.chat)
|
env.chat.json.mobile(chat = c.chat)
|
||||||
}))
|
}))
|
||||||
}
|
}
|
||||||
.monSuccess(_.tournament.apiShowPartial(getBool("partial"), HTTPRequest clientName ctx.req))
|
.monSuccess(_.tournament.apiShowPartial(getBool("partial"), HTTPRequest clientName ctx.req))
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
package lila.app
|
package lila.app
|
||||||
package templating
|
package templating
|
||||||
|
|
||||||
|
import play.api.libs.json.JsValue
|
||||||
import scala.concurrent.duration._
|
import scala.concurrent.duration._
|
||||||
|
|
||||||
import lila.app.ui.ScalatagsTemplate._
|
import lila.app.ui.ScalatagsTemplate._
|
||||||
|
@ -44,6 +45,8 @@ object Environment
|
||||||
|
|
||||||
def isChatPanicEnabled = env.chat.panic.enabled
|
def isChatPanicEnabled = env.chat.panic.enabled
|
||||||
|
|
||||||
|
def chatLinesToJson(chat: lila.chat.AnyChat): JsValue = env.chat.json(chat)
|
||||||
|
|
||||||
def blockingReportScores: (Int, Int, Int) = (
|
def blockingReportScores: (Int, Int, Int) = (
|
||||||
env.report.api.maxScores.dmap(_.highest).awaitOrElse(50.millis, "nbReports", 0),
|
env.report.api.maxScores.dmap(_.highest).awaitOrElse(50.millis, "nbReports", 0),
|
||||||
env.report.scoreThresholdsSetting.get().mid,
|
env.report.scoreThresholdsSetting.get().mid,
|
||||||
|
|
|
@ -16,7 +16,7 @@ object chat {
|
||||||
div(cls := "mchat__content")
|
div(cls := "mchat__content")
|
||||||
)
|
)
|
||||||
|
|
||||||
import lila.chat.JsonView.writers.chatIdWrites
|
import lila.chat.JsonView.chatIdWrites
|
||||||
|
|
||||||
def restrictedJson(
|
def restrictedJson(
|
||||||
chat: lila.chat.Chat.Restricted,
|
chat: lila.chat.Chat.Restricted,
|
||||||
|
@ -60,7 +60,7 @@ object chat {
|
||||||
.obj(
|
.obj(
|
||||||
"id" -> chat.id,
|
"id" -> chat.id,
|
||||||
"name" -> name,
|
"name" -> name,
|
||||||
"lines" -> lila.chat.JsonView(chat),
|
"lines" -> chatLinesToJson(chat),
|
||||||
"userId" -> ctx.userId,
|
"userId" -> ctx.userId,
|
||||||
"resourceId" -> resourceId.value
|
"resourceId" -> resourceId.value
|
||||||
)
|
)
|
||||||
|
|
|
@ -97,7 +97,7 @@ final class GameStateStream(
|
||||||
|
|
||||||
def receive = {
|
def receive = {
|
||||||
case MoveGameEvent(g, _, _) if g.id == id && !g.finished => pushState(g).unit
|
case MoveGameEvent(g, _, _) if g.id == id && !g.finished => pushState(g).unit
|
||||||
case lila.chat.actorApi.ChatLine(chatId, UserLine(username, _, text, false, false)) =>
|
case lila.chat.actorApi.ChatLine(chatId, UserLine(username, text, false, false)) =>
|
||||||
pushChatLine(username, text, chatId.value.lengthIs == Game.gameIdSize).unit
|
pushChatLine(username, text, chatId.value.lengthIs == Game.gameIdSize).unit
|
||||||
case FinishGame(g, _, _) if g.id == id => onGameOver(g.some).unit
|
case FinishGame(g, _, _) if g.id == id => onGameOver(g.some).unit
|
||||||
case AbortedBy(pov) if pov.gameId == id => onGameOver(pov.game.some).unit
|
case AbortedBy(pov) if pov.gameId == id => onGameOver(pov.game.some).unit
|
||||||
|
|
|
@ -8,9 +8,7 @@ import lila.user.User
|
||||||
|
|
||||||
final class JsonView(lightUserSync: LightUser.GetterSync) {
|
final class JsonView(lightUserSync: LightUser.GetterSync) {
|
||||||
|
|
||||||
import writers._
|
import JsonView._
|
||||||
|
|
||||||
lazy val timeoutReasons = Json toJson ChatTimeout.Reason.all
|
|
||||||
|
|
||||||
def apply(chat: AnyChat): JsValue =
|
def apply(chat: AnyChat): JsValue =
|
||||||
chat match {
|
chat match {
|
||||||
|
@ -18,8 +16,6 @@ final class JsonView(lightUserSync: LightUser.GetterSync) {
|
||||||
case c: UserChat => userChatWriter writes c
|
case c: UserChat => userChatWriter writes c
|
||||||
}
|
}
|
||||||
|
|
||||||
def apply(line: Line): JsObject = lineWriter writes line
|
|
||||||
|
|
||||||
def userModInfo(u: UserModInfo)(implicit lightUser: LightUser.GetterSync) =
|
def userModInfo(u: UserModInfo)(implicit lightUser: LightUser.GetterSync) =
|
||||||
lila.user.JsonView.modWrites.writes(u.user) ++ Json.obj(
|
lila.user.JsonView.modWrites.writes(u.user) ++ Json.obj(
|
||||||
"history" -> u.history
|
"history" -> u.history
|
||||||
|
@ -31,55 +27,57 @@ final class JsonView(lightUserSync: LightUser.GetterSync) {
|
||||||
"writeable" -> writeable
|
"writeable" -> writeable
|
||||||
)
|
)
|
||||||
|
|
||||||
object writers {
|
implicit val mixedChatWriter: Writes[MixedChat] = Writes[MixedChat] { c =>
|
||||||
|
JsArray(c.lines map lineWriter.writes)
|
||||||
|
}
|
||||||
|
|
||||||
implicit val chatIdWrites: Writes[Chat.Id] = stringIsoWriter(Chat.chatIdIso)
|
implicit val userChatWriter: Writes[UserChat] = Writes[UserChat] { c =>
|
||||||
|
JsArray(c.lines map userLineWriter.writes)
|
||||||
|
}
|
||||||
|
|
||||||
implicit val timeoutReasonWriter: Writes[ChatTimeout.Reason] = OWrites[ChatTimeout.Reason] { r =>
|
implicit val lineWriter: OWrites[Line] = OWrites[Line] {
|
||||||
Json.obj("key" -> r.key, "name" -> r.name)
|
case l: UserLine => userLineWriter writes l
|
||||||
}
|
case l: PlayerLine => playerLineWriter writes l
|
||||||
|
}
|
||||||
|
|
||||||
implicit def timeoutEntryWriter: OWrites[ChatTimeout.UserEntry] =
|
implicit private val userLineWriter = OWrites[UserLine] { l =>
|
||||||
OWrites[ChatTimeout.UserEntry] { e =>
|
val userId = User normalize l.username
|
||||||
Json.obj(
|
val u = lightUserSync(userId) | LightUser.fallback(userId)
|
||||||
"reason" -> e.reason.key,
|
Json
|
||||||
"mod" -> lightUserSync(e.mod).fold("?")(_.name),
|
.obj(
|
||||||
"date" -> e.createdAt
|
"u" -> l.username,
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
implicit val mixedChatWriter: Writes[MixedChat] = Writes[MixedChat] { c =>
|
|
||||||
JsArray(c.lines map lineWriter.writes)
|
|
||||||
}
|
|
||||||
|
|
||||||
implicit val userChatWriter: Writes[UserChat] = Writes[UserChat] { c =>
|
|
||||||
JsArray(c.lines map userLineWriter.writes)
|
|
||||||
}
|
|
||||||
|
|
||||||
implicit private[chat] val lineWriter: OWrites[Line] = OWrites[Line] {
|
|
||||||
case l: UserLine => userLineWriter writes l
|
|
||||||
case l: PlayerLine => playerLineWriter writes l
|
|
||||||
}
|
|
||||||
|
|
||||||
implicit private val userLineWriter = OWrites[UserLine] { l =>
|
|
||||||
val userId = User normalize l.username
|
|
||||||
val u = lightUserSync(userId) | LightUser.fallback(userId)
|
|
||||||
Json
|
|
||||||
.obj(
|
|
||||||
"u" -> l.username,
|
|
||||||
"t" -> l.text
|
|
||||||
)
|
|
||||||
.add("r" -> l.troll)
|
|
||||||
.add("d" -> l.deleted)
|
|
||||||
.add("title" -> u.title)
|
|
||||||
.add("p" -> u.isPatron)
|
|
||||||
}
|
|
||||||
|
|
||||||
implicit private val playerLineWriter = OWrites[PlayerLine] { l =>
|
|
||||||
Json.obj(
|
|
||||||
"c" -> l.color.name,
|
|
||||||
"t" -> l.text
|
"t" -> l.text
|
||||||
)
|
)
|
||||||
|
.add("r" -> l.troll)
|
||||||
|
.add("d" -> l.deleted)
|
||||||
|
.add("title" -> u.title)
|
||||||
|
.add("p" -> u.isPatron)
|
||||||
|
}
|
||||||
|
|
||||||
|
implicit def timeoutEntryWriter: OWrites[ChatTimeout.UserEntry] =
|
||||||
|
OWrites[ChatTimeout.UserEntry] { e =>
|
||||||
|
Json.obj(
|
||||||
|
"reason" -> e.reason.key,
|
||||||
|
"mod" -> lightUserSync(e.mod).fold("?")(_.name),
|
||||||
|
"date" -> e.createdAt
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
object JsonView {
|
||||||
|
|
||||||
|
lazy val timeoutReasons = Json toJson ChatTimeout.Reason.all
|
||||||
|
|
||||||
|
implicit val chatIdWrites: Writes[Chat.Id] = stringIsoWriter(Chat.chatIdIso)
|
||||||
|
|
||||||
|
implicit val timeoutReasonWriter: Writes[ChatTimeout.Reason] = OWrites[ChatTimeout.Reason] { r =>
|
||||||
|
Json.obj("key" -> r.key, "name" -> r.name)
|
||||||
|
}
|
||||||
|
|
||||||
|
implicit private val playerLineWriter = OWrites[PlayerLine] { l =>
|
||||||
|
Json.obj(
|
||||||
|
"c" -> l.color.name,
|
||||||
|
"t" -> l.text
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -251,14 +251,14 @@ object Event {
|
||||||
|
|
||||||
case class PlayerMessage(line: PlayerLine) extends Event {
|
case class PlayerMessage(line: PlayerLine) extends Event {
|
||||||
def typ = "message"
|
def typ = "message"
|
||||||
def data = lila.chat.JsonView(line)
|
def data = JsNull
|
||||||
override def owner = true
|
override def owner = true
|
||||||
override def troll = false
|
override def troll = false
|
||||||
}
|
}
|
||||||
|
|
||||||
case class UserMessage(line: UserLine, w: Boolean) extends Event {
|
case class UserMessage(line: UserLine, w: Boolean) extends Event {
|
||||||
def typ = "message"
|
def typ = "message"
|
||||||
def data = lila.chat.JsonView(line)
|
def data = sys error "oh no what have I done"
|
||||||
override def troll = line.troll
|
override def troll = line.troll
|
||||||
override def watcher = w
|
override def watcher = w
|
||||||
override def owner = !w
|
override def owner = !w
|
||||||
|
|
|
@ -109,11 +109,15 @@ object RoomSocket {
|
||||||
|
|
||||||
private val chatMsgs = Set("message", "chat_timeout", "chat_reinstate")
|
private val chatMsgs = Set("message", "chat_timeout", "chat_reinstate")
|
||||||
|
|
||||||
def subscribeChat(rooms: TrouperMap[RoomState], busChan: BusChan.Select) = {
|
def subscribeChat(
|
||||||
|
rooms: TrouperMap[RoomState],
|
||||||
|
busChan: BusChan.Select,
|
||||||
|
chatLineWriter: OWrites[lila.chat.Line]
|
||||||
|
) = {
|
||||||
import lila.chat.actorApi._
|
import lila.chat.actorApi._
|
||||||
lila.common.Bus.subscribeFun(busChan(BusChan).chan, BusChan.Global.chan) {
|
lila.common.Bus.subscribeFun(busChan(BusChan).chan, BusChan.Global.chan) {
|
||||||
case ChatLine(id, line: UserLine) =>
|
case ChatLine(id, line: UserLine) =>
|
||||||
rooms.tellIfPresent(id.value, NotifyVersion("message", lila.chat.JsonView(line), line.troll))
|
rooms.tellIfPresent(id.value, NotifyVersion("message", chatLineWriter writes line, line.troll))
|
||||||
case OnTimeout(id, userId) =>
|
case OnTimeout(id, userId) =>
|
||||||
rooms.tellIfPresent(id.value, NotifyVersion("chat_timeout", userId, troll = false))
|
rooms.tellIfPresent(id.value, NotifyVersion("chat_timeout", userId, troll = false))
|
||||||
case OnReinstate(id, userId) =>
|
case OnReinstate(id, userId) =>
|
||||||
|
|
|
@ -25,6 +25,7 @@ final class Env(
|
||||||
renderer: lila.hub.actors.Renderer,
|
renderer: lila.hub.actors.Renderer,
|
||||||
timeline: lila.hub.actors.Timeline,
|
timeline: lila.hub.actors.Timeline,
|
||||||
chatApi: lila.chat.ChatApi,
|
chatApi: lila.chat.ChatApi,
|
||||||
|
chatJson: lila.chat.JsonView,
|
||||||
lightUser: lila.common.LightUser.Getter,
|
lightUser: lila.common.LightUser.Getter,
|
||||||
onGameStart: lila.round.OnStart,
|
onGameStart: lila.round.OnStart,
|
||||||
cacheApi: lila.memo.CacheApi,
|
cacheApi: lila.memo.CacheApi,
|
||||||
|
|
|
@ -12,7 +12,8 @@ final private class SimulSocket(
|
||||||
repo: SimulRepo,
|
repo: SimulRepo,
|
||||||
jsonView: JsonView,
|
jsonView: JsonView,
|
||||||
remoteSocketApi: lila.socket.RemoteSocket,
|
remoteSocketApi: lila.socket.RemoteSocket,
|
||||||
chat: lila.chat.ChatApi
|
chatApi: lila.chat.ChatApi,
|
||||||
|
chatJson: lila.chat.JsonView
|
||||||
)(implicit
|
)(implicit
|
||||||
ec: scala.concurrent.ExecutionContext,
|
ec: scala.concurrent.ExecutionContext,
|
||||||
mode: play.api.Mode
|
mode: play.api.Mode
|
||||||
|
@ -56,12 +57,12 @@ final private class SimulSocket(
|
||||||
|
|
||||||
lazy val rooms = makeRoomMap(send)
|
lazy val rooms = makeRoomMap(send)
|
||||||
|
|
||||||
subscribeChat(rooms, _.Simul)
|
subscribeChat(rooms, _.Simul, chatJson.lineWriter)
|
||||||
|
|
||||||
private lazy val handler: Handler =
|
private lazy val handler: Handler =
|
||||||
roomHandler(
|
roomHandler(
|
||||||
rooms,
|
rooms,
|
||||||
chat,
|
chatApi,
|
||||||
logger,
|
logger,
|
||||||
roomId => _.Simul(roomId.value).some,
|
roomId => _.Simul(roomId.value).some,
|
||||||
chatBusChan = _.Simul,
|
chatBusChan = _.Simul,
|
||||||
|
|
|
@ -25,6 +25,7 @@ final class Env(
|
||||||
timeline: lila.hub.actors.Timeline,
|
timeline: lila.hub.actors.Timeline,
|
||||||
fishnet: lila.hub.actors.Fishnet,
|
fishnet: lila.hub.actors.Fishnet,
|
||||||
chatApi: lila.chat.ChatApi,
|
chatApi: lila.chat.ChatApi,
|
||||||
|
chatJson: lila.chat.JsonView,
|
||||||
mongo: lila.db.Env,
|
mongo: lila.db.Env,
|
||||||
net: lila.common.config.NetConfig,
|
net: lila.common.config.NetConfig,
|
||||||
cacheApi: lila.memo.CacheApi
|
cacheApi: lila.memo.CacheApi
|
||||||
|
|
|
@ -19,7 +19,8 @@ final private class StudySocket(
|
||||||
api: StudyApi,
|
api: StudyApi,
|
||||||
jsonView: JsonView,
|
jsonView: JsonView,
|
||||||
remoteSocketApi: lila.socket.RemoteSocket,
|
remoteSocketApi: lila.socket.RemoteSocket,
|
||||||
chatApi: lila.chat.ChatApi
|
chatApi: lila.chat.ChatApi,
|
||||||
|
chatJson: lila.chat.JsonView
|
||||||
)(implicit
|
)(implicit
|
||||||
ec: scala.concurrent.ExecutionContext,
|
ec: scala.concurrent.ExecutionContext,
|
||||||
mode: play.api.Mode
|
mode: play.api.Mode
|
||||||
|
@ -32,7 +33,7 @@ final private class StudySocket(
|
||||||
|
|
||||||
lazy val rooms = makeRoomMap(send)
|
lazy val rooms = makeRoomMap(send)
|
||||||
|
|
||||||
subscribeChat(rooms, _.Study)
|
subscribeChat(rooms, _.Study, chatJson.lineWriter)
|
||||||
|
|
||||||
def isPresent(studyId: Study.Id, userId: User.ID): Fu[Boolean] =
|
def isPresent(studyId: Study.Id, userId: User.ID): Fu[Boolean] =
|
||||||
remoteSocketApi.request[Boolean](
|
remoteSocketApi.request[Boolean](
|
||||||
|
|
|
@ -17,6 +17,7 @@ final class Env(
|
||||||
onStart: lila.round.OnStart,
|
onStart: lila.round.OnStart,
|
||||||
remoteSocketApi: lila.socket.RemoteSocket,
|
remoteSocketApi: lila.socket.RemoteSocket,
|
||||||
chatApi: lila.chat.ChatApi,
|
chatApi: lila.chat.ChatApi,
|
||||||
|
chatJson: lila.chat.JsonView,
|
||||||
cacheApi: lila.memo.CacheApi,
|
cacheApi: lila.memo.CacheApi,
|
||||||
lightUserApi: lila.user.LightUserApi,
|
lightUserApi: lila.user.LightUserApi,
|
||||||
historyApi: lila.history.HistoryApi,
|
historyApi: lila.history.HistoryApi,
|
||||||
|
|
|
@ -11,7 +11,8 @@ import lila.socket.Socket.makeMessage
|
||||||
|
|
||||||
final private class SwissSocket(
|
final private class SwissSocket(
|
||||||
remoteSocketApi: lila.socket.RemoteSocket,
|
remoteSocketApi: lila.socket.RemoteSocket,
|
||||||
chat: lila.chat.ChatApi,
|
chatApi: lila.chat.ChatApi,
|
||||||
|
chatJson: lila.chat.JsonView,
|
||||||
teamOf: Swiss.Id => Fu[Option[TeamID]]
|
teamOf: Swiss.Id => Fu[Option[TeamID]]
|
||||||
)(implicit
|
)(implicit
|
||||||
ec: scala.concurrent.ExecutionContext,
|
ec: scala.concurrent.ExecutionContext,
|
||||||
|
@ -32,12 +33,12 @@ final private class SwissSocket(
|
||||||
|
|
||||||
lazy val rooms = makeRoomMap(send)
|
lazy val rooms = makeRoomMap(send)
|
||||||
|
|
||||||
subscribeChat(rooms, _.Swiss)
|
subscribeChat(rooms, _.Swiss, chatJson.lineWriter)
|
||||||
|
|
||||||
private lazy val handler: Handler =
|
private lazy val handler: Handler =
|
||||||
roomHandler(
|
roomHandler(
|
||||||
rooms,
|
rooms,
|
||||||
chat,
|
chatApi,
|
||||||
logger,
|
logger,
|
||||||
roomId => _.Swiss(roomId.value).some,
|
roomId => _.Swiss(roomId.value).some,
|
||||||
localTimeout = Some { (roomId, modId, _) =>
|
localTimeout = Some { (roomId, modId, _) =>
|
||||||
|
|
|
@ -18,6 +18,7 @@ final class Env(
|
||||||
notifyApi: NotifyApi,
|
notifyApi: NotifyApi,
|
||||||
remoteSocketApi: lila.socket.RemoteSocket,
|
remoteSocketApi: lila.socket.RemoteSocket,
|
||||||
chatApi: lila.chat.ChatApi,
|
chatApi: lila.chat.ChatApi,
|
||||||
|
chatJson: lila.chat.JsonView,
|
||||||
cacheApi: lila.memo.CacheApi,
|
cacheApi: lila.memo.CacheApi,
|
||||||
lightUserApi: lila.user.LightUserApi,
|
lightUserApi: lila.user.LightUserApi,
|
||||||
db: lila.db.Db
|
db: lila.db.Db
|
||||||
|
|
|
@ -5,7 +5,8 @@ import lila.socket.RemoteSocket.{ Protocol => P, _ }
|
||||||
|
|
||||||
final private class TeamSocket(
|
final private class TeamSocket(
|
||||||
remoteSocketApi: lila.socket.RemoteSocket,
|
remoteSocketApi: lila.socket.RemoteSocket,
|
||||||
chat: lila.chat.ChatApi,
|
chatApi: lila.chat.ChatApi,
|
||||||
|
chatJson: lila.chat.JsonView,
|
||||||
cached: Cached
|
cached: Cached
|
||||||
)(implicit
|
)(implicit
|
||||||
ec: scala.concurrent.ExecutionContext,
|
ec: scala.concurrent.ExecutionContext,
|
||||||
|
@ -14,12 +15,12 @@ final private class TeamSocket(
|
||||||
|
|
||||||
lazy val rooms = makeRoomMap(send)
|
lazy val rooms = makeRoomMap(send)
|
||||||
|
|
||||||
subscribeChat(rooms, _.Team)
|
subscribeChat(rooms, _.Team, chatJson.lineWriter)
|
||||||
|
|
||||||
private lazy val handler: Handler =
|
private lazy val handler: Handler =
|
||||||
roomHandler(
|
roomHandler(
|
||||||
rooms,
|
rooms,
|
||||||
chat,
|
chatApi,
|
||||||
logger,
|
logger,
|
||||||
roomId => _.Team(roomId.value).some,
|
roomId => _.Team(roomId.value).some,
|
||||||
localTimeout = Some { (roomId, modId, suspectId) =>
|
localTimeout = Some { (roomId, modId, suspectId) =>
|
||||||
|
|
|
@ -30,6 +30,7 @@ final class Env(
|
||||||
proxyRepo: lila.round.GameProxyRepo,
|
proxyRepo: lila.round.GameProxyRepo,
|
||||||
renderer: lila.hub.actors.Renderer,
|
renderer: lila.hub.actors.Renderer,
|
||||||
chatApi: lila.chat.ChatApi,
|
chatApi: lila.chat.ChatApi,
|
||||||
|
chatJson: lila.chat.JsonView,
|
||||||
tellRound: lila.round.TellRound,
|
tellRound: lila.round.TellRound,
|
||||||
roundSocket: lila.round.RoundSocket,
|
roundSocket: lila.round.RoundSocket,
|
||||||
lightUserApi: lila.user.LightUserApi,
|
lightUserApi: lila.user.LightUserApi,
|
||||||
|
|
|
@ -15,7 +15,8 @@ import lila.user.User
|
||||||
final private class TournamentSocket(
|
final private class TournamentSocket(
|
||||||
repo: TournamentRepo,
|
repo: TournamentRepo,
|
||||||
remoteSocketApi: lila.socket.RemoteSocket,
|
remoteSocketApi: lila.socket.RemoteSocket,
|
||||||
chat: lila.chat.ChatApi
|
chatApi: lila.chat.ChatApi,
|
||||||
|
chatJson: lila.chat.JsonView
|
||||||
)(implicit
|
)(implicit
|
||||||
ec: scala.concurrent.ExecutionContext,
|
ec: scala.concurrent.ExecutionContext,
|
||||||
system: ActorSystem,
|
system: ActorSystem,
|
||||||
|
@ -65,12 +66,12 @@ final private class TournamentSocket(
|
||||||
|
|
||||||
lazy val rooms = makeRoomMap(send)
|
lazy val rooms = makeRoomMap(send)
|
||||||
|
|
||||||
subscribeChat(rooms, _.Tournament)
|
subscribeChat(rooms, _.Tournament, chatJson.lineWriter)
|
||||||
|
|
||||||
private lazy val handler: Handler =
|
private lazy val handler: Handler =
|
||||||
roomHandler(
|
roomHandler(
|
||||||
rooms,
|
rooms,
|
||||||
chat,
|
chatApi,
|
||||||
logger,
|
logger,
|
||||||
roomId => _.Tournament(roomId.value).some,
|
roomId => _.Tournament(roomId.value).some,
|
||||||
chatBusChan = _.Tournament,
|
chatBusChan = _.Tournament,
|
||||||
|
|
Loading…
Reference in New Issue