prevent autoswitch when opponent premoved - closes #1074
parent
206dd3292c
commit
598a06604a
|
@ -111,9 +111,12 @@ object Round extends LilaController with TheftPrevention {
|
|||
}
|
||||
}
|
||||
|
||||
def whatsNext(gameId: String) = Open { implicit ctx =>
|
||||
OptionFuResult(GameRepo game gameId) { currentGame =>
|
||||
otherPovs(currentGame) map getNext(currentGame) map { next =>
|
||||
def whatsNext(fullId: String) = Open { implicit ctx =>
|
||||
OptionFuResult(GameRepo pov fullId) { currentPov =>
|
||||
if (currentPov.isMyTurn) fuccess {
|
||||
Ok(Json.obj("next" -> null))
|
||||
}
|
||||
else otherPovs(currentPov.game) map getNext(currentPov.game) map { next =>
|
||||
Ok(Json.obj("next" -> next.map(_.fullId)))
|
||||
}
|
||||
}
|
||||
|
|
|
@ -132,7 +132,7 @@ POST /$fullId<\w{12}>/resign controllers.Round.resign(fullId
|
|||
POST /$gameId<\w{8}>/delete controllers.Game.delete(gameId: String)
|
||||
|
||||
GET /round-next/$gameId<\w{8}> controllers.Round.next(gameId: String)
|
||||
GET /whats-next/$gameId<\w{8}> controllers.Round.whatsNext(gameId: String)
|
||||
GET /whats-next/$fullId<\w{12}> controllers.Round.whatsNext(fullId: String)
|
||||
|
||||
# Round accessibility: text representation
|
||||
GET /$fullId<\w{12}>/text controllers.Round.playerText(fullId: String)
|
||||
|
|
|
@ -25,7 +25,7 @@ function reload(ctrl) {
|
|||
function whatsNext(ctrl) {
|
||||
return m.request({
|
||||
method: 'GET',
|
||||
url: uncache('/whats-next/' + ctrl.data.game.id),
|
||||
url: uncache('/whats-next/' + ctrl.data.game.id + ctrl.data.player.id),
|
||||
config: xhrConfig
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue