only show game study if made by a player

pull/9617/head^2
Thibault Duplessis 2021-08-21 11:06:04 +02:00
parent d88d82484f
commit 8631b6028d
2 changed files with 3 additions and 1 deletions

View File

@ -61,6 +61,8 @@ case class Game(
def hasUserIds(userId1: User.ID, userId2: User.ID) =
playerByUserId(userId1).isDefined && playerByUserId(userId2).isDefined
def hasUserId(userId: User.ID) = playerByUserId(userId).isDefined
def opponent(p: Player): Player = opponent(p.color)
def opponent(c: Color): Player = player(!c)

View File

@ -157,7 +157,7 @@ final private class ChapterMaker(
)
def notifyChat(study: Study, game: Game, userId: User.ID) =
if (study.isPublic) List(game.id, s"${game.id}/w") foreach { chatId =>
if (study.isPublic) List(game hasUserId userId option game.id, s"${game.id}/w".some).flatten foreach { chatId =>
chatApi.userChat.write(
chatId = Chat.Id(chatId),
userId = userId,