fix TV flip button
This commit is contained in:
parent
02ed27f578
commit
3b08a6f4ff
|
@ -85,12 +85,12 @@ object Round extends LilaController with TheftPrevention {
|
|||
case None =>
|
||||
(pov.game.tournamentId ?? TournamentRepo.byId) zip
|
||||
Env.game.crosstableApi(pov.game) zip
|
||||
Env.api.roundApi.watcher(pov, Env.api.version, tv = false, userTv = userTv) map {
|
||||
Env.api.roundApi.watcher(pov, Env.api.version, tv = none, userTv = userTv) map {
|
||||
case ((tour, crosstable), data) =>
|
||||
Ok(html.round.watcher(pov, data, tour, crosstable, userTv = userTv))
|
||||
}
|
||||
},
|
||||
api = apiVersion => Env.api.roundApi.watcher(pov, apiVersion, tv = false) map { Ok(_) }
|
||||
api = apiVersion => Env.api.roundApi.watcher(pov, apiVersion, tv = none) map { Ok(_) }
|
||||
)
|
||||
|
||||
private def join(pov: Pov)(implicit ctx: Context): Fu[Result] =
|
||||
|
|
|
@ -36,7 +36,7 @@ object Tv extends LilaController {
|
|||
private def lichessTv(implicit ctx: Context) = OptionFuResult(Env.tv.featured.one) { game =>
|
||||
val flip = getBool("flip")
|
||||
val pov = flip.fold(Pov second game, Pov first game)
|
||||
Env.api.roundApi.watcher(pov, Env.api.version, tv = true) zip
|
||||
Env.api.roundApi.watcher(pov, Env.api.version, tv = flip.some) zip
|
||||
(GameRepo onTv 10) zip
|
||||
Env.game.crosstableApi(game) zip
|
||||
Env.tv.streamsOnAir zip
|
||||
|
|
|
@ -8,4 +8,5 @@ routes.javascript.Round.watcher,
|
|||
routes.javascript.Round.playerText,
|
||||
routes.javascript.Round.watcherText,
|
||||
routes.javascript.Round.sideWatcher,
|
||||
routes.javascript.Tv.index,
|
||||
routes.javascript.Tv.side)(ctx.req)
|
||||
|
|
|
@ -22,7 +22,7 @@ private[api] final class RoundApi(jsonView: JsonView) {
|
|||
}
|
||||
}
|
||||
|
||||
def watcher(pov: Pov, apiVersion: Int, tv: Boolean, userTv: Option[User] = None)(implicit ctx: Context): Fu[JsObject] =
|
||||
def watcher(pov: Pov, apiVersion: Int, tv: Option[Boolean], userTv: Option[User] = None)(implicit ctx: Context): Fu[JsObject] =
|
||||
jsonView.watcherJson(pov, ctx.pref, apiVersion, ctx.me, tv,
|
||||
withBlurs = ctx.me ?? Granter(_.ViewBlurs)) zip
|
||||
(pov.game.tournamentId ?? TournamentRepo.byId) map {
|
||||
|
|
|
@ -121,7 +121,7 @@ final class JsonView(
|
|||
pref: Pref,
|
||||
apiVersion: Int,
|
||||
user: Option[User],
|
||||
tv: Boolean,
|
||||
tv: Option[Boolean],
|
||||
withBlurs: Boolean) =
|
||||
getVersion(pov.game.id) zip
|
||||
isGone(pov.game.id, pov.color) zip
|
||||
|
@ -182,7 +182,9 @@ final class JsonView(
|
|||
"clockBar" -> pref.clockBar,
|
||||
"showCaptured" -> pref.captured
|
||||
),
|
||||
"tv" -> tv,
|
||||
"tv" -> tv.map { flip =>
|
||||
Json.obj("flip" -> flip)
|
||||
},
|
||||
"chat" -> chat.map { c =>
|
||||
JsArray(c.lines map {
|
||||
case lila.chat.UserLine(username, text, _) => Json.obj(
|
||||
|
|
|
@ -133,7 +133,7 @@ module.exports = {
|
|||
},
|
||||
flip: function(ctrl) {
|
||||
if (ctrl.data.player.spectator) return m('a.button[data-icon=B]', {
|
||||
href: ctrl.router.Round.watcher(ctrl.data.game.id, chessground.util.opposite(ctrl.data.player.color)).url
|
||||
href: ctrl.data.tv ? ctrl.router.Tv.index().url + (ctrl.data.tv.flip ? '' : '?flip=1') : ctrl.router.Round.watcher(ctrl.data.game.id, chessground.util.opposite(ctrl.data.player.color)).url
|
||||
}, ctrl.trans('flipBoard'));
|
||||
},
|
||||
replayAndAnalyse: function(ctrl) {
|
||||
|
|
Loading…
Reference in a new issue