add support for watcher chat in mobile API
This commit is contained in:
parent
b0153faf48
commit
5957a4d6ac
|
@ -187,13 +187,18 @@ object Round extends LilaController with TheftPrevention {
|
|||
Ok(html.round.watcherBot(pov, initialFen, pgn))
|
||||
}
|
||||
}.mon(_.http.response.watcher.website),
|
||||
api = apiVersion =>
|
||||
Env.api.roundApi.watcher(pov, apiVersion, tv = none) flatMap { json =>
|
||||
pov.game.metadata.analysed.??(analyser get pov.game.id) map { analysis =>
|
||||
Ok(analysis.fold(json) { a =>
|
||||
json + ("analysis" -> lila.analyse.JsonView.mobile(pov.game, a))
|
||||
})
|
||||
api = apiVersion => for {
|
||||
data <- Env.api.roundApi.watcher(pov, apiVersion, tv = none)
|
||||
analysis <- pov.game.metadata.analysed.??(analyser get pov.game.id)
|
||||
chat <- getWatcherChat(pov.game)
|
||||
} yield {
|
||||
val withChat = chat.fold(data) { c =>
|
||||
data + ("chat" -> lila.chat.JsonView(c.chat))
|
||||
}
|
||||
val withAnalysis = analysis.fold(withChat) { a =>
|
||||
withChat + ("analysis" -> lila.analyse.JsonView.mobile(pov.game, a))
|
||||
}
|
||||
Ok(withAnalysis)
|
||||
}
|
||||
) map NoCache
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue