player can see spectator chat after the game is over

This commit is contained in:
Thibault Duplessis 2018-04-27 06:11:15 +02:00
parent abb6bed643
commit 3d17926481

View file

@ -203,7 +203,9 @@ object Round extends LilaController with TheftPrevention {
tourId ?? { Env.tournament.api.miniView(_, withTop) }
private[controllers] def getWatcherChat(game: GameModel)(implicit ctx: Context): Fu[Option[lila.chat.UserChat.Mine]] = {
ctx.noKid && ctx.me.exists(Env.chat.panic.allowed) && !ctx.userId.exists(game.userIds.contains)
ctx.noKid && ctx.me.exists(Env.chat.panic.allowed) && {
game.finishedOrAborted || !ctx.userId.exists(game.userIds.contains)
}
} ?? {
Env.chat.api.userChat.findMineIf(Chat.Id(s"${game.id}/w"), ctx.me, !game.justCreated) flatMap { chat =>
Env.user.lightUserApi.preloadMany(chat.chat.userIds) inject chat.some