{master} in-game simul UI is only for the host

This commit is contained in:
Thibault Duplessis 2018-01-23 08:52:56 -05:00
parent 2f3124bf2d
commit d52b9a3f67
3 changed files with 4 additions and 3 deletions

View file

@ -61,7 +61,7 @@ object Round extends LilaController with TheftPrevention {
simul foreach Env.simul.api.onPlayerConnection(pov.game, ctx.me)
Ok(html.round.player(pov, data,
tour = tour,
simul = simul,
simul = simul.filter(_ isHost ctx.me),
cross = crosstable,
playing = playing,
chatOption = chatOption,

View file

@ -109,7 +109,8 @@ case class Simul(
def variantRich = variants.size > 3
def isHost(userOption: Option[User]) = userOption ?? (_.id == hostId)
def isHost(userOption: Option[User]): Boolean = userOption ?? isHost
def isHost(user: User): Boolean = user.id == hostId
def playingPairings = pairings filterNot (_.finished)

View file

@ -116,7 +116,7 @@ final class SimulApi(
}
def onPlayerConnection(game: Game, user: Option[User])(simul: Simul): Unit = {
user.filter(_.id == simul.hostId) ifTrue simul.isRunning foreach { host =>
user.filter(simul.isHost) ifTrue simul.isRunning foreach { host =>
repo.setHostGameId(simul, game.id)
sendTo(simul.id, actorApi.HostIsOn(game.id))
}