don't redirect round players, save play UI from watch URL
This commit is contained in:
parent
81de8f2331
commit
75bdd28e5b
|
@ -53,9 +53,7 @@ object Round extends LilaController with TheftPrevention {
|
|||
}
|
||||
}
|
||||
|
||||
def player(fullId: String) = Open { implicit ctx =>
|
||||
OptionFuResult(GameRepo pov fullId) { pov =>
|
||||
negotiate(
|
||||
private def renderPlayer(pov: Pov)(implicit ctx: Context): Fu[Result] = negotiate(
|
||||
html = {
|
||||
if (pov.game.playableByAi) env.roundMap ! Tell(pov.game.id, AiPlay)
|
||||
pov.game.started.fold(
|
||||
|
@ -65,12 +63,13 @@ object Round extends LilaController with TheftPrevention {
|
|||
Env.game.crosstableApi(pov.game) zip
|
||||
(!pov.game.isTournament ?? otherPovs(pov.gameId)) flatMap {
|
||||
case (((tour, simul), crosstable), playing) =>
|
||||
simul foreach Env.simul.api.onPlayerConnection(pov.game, ctx.me)
|
||||
Env.api.roundApi.player(pov, lila.api.Mobile.Api.currentVersion) map { data =>
|
||||
Ok(html.round.player(pov, data, tour = tour, simul = simul, cross = crosstable, playing = playing))
|
||||
}
|
||||
}
|
||||
},
|
||||
Redirect(routes.Setup.await(fullId)).fuccess
|
||||
Redirect(routes.Setup.await(pov.fullId)).fuccess
|
||||
)
|
||||
},
|
||||
api = apiVersion => {
|
||||
|
@ -81,6 +80,10 @@ object Round extends LilaController with TheftPrevention {
|
|||
}
|
||||
}
|
||||
)
|
||||
|
||||
def player(fullId: String) = Open { implicit ctx =>
|
||||
OptionFuResult(GameRepo pov fullId) { pov =>
|
||||
renderPlayer(pov)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -121,8 +124,8 @@ object Round extends LilaController with TheftPrevention {
|
|||
negotiate(
|
||||
html = if (pov.game.replayable) Analyse.replay(pov, userTv = userTv)
|
||||
else if (pov.game.joinable) join(pov)
|
||||
else ctx.userId.flatMap(pov.game.playerByUserId).ifTrue(pov.game.playable) match {
|
||||
case Some(player) => fuccess(Redirect(routes.Round.player(pov.game fullIdOf player.color)))
|
||||
else ctx.userId.flatMap(pov.game.playerByUserId) ifTrue pov.game.playable match {
|
||||
case Some(player) => renderPlayer(pov)
|
||||
case None =>
|
||||
(pov.game.tournamentId ?? TournamentRepo.byId) zip
|
||||
(pov.game.simulId ?? Env.simul.repo.find) zip
|
||||
|
|
Loading…
Reference in a new issue