Skip to content

Commit

Permalink
remove swiss dep to chat
Browse files Browse the repository at this point in the history
  • Loading branch information
ornicar committed Apr 11, 2024
1 parent f408121 commit 1f9464c
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 8 deletions.
2 changes: 1 addition & 1 deletion build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,7 @@ lazy val tournament = module("tournament",
)

lazy val swiss = module("swiss",
Seq(gathering, user, game, chat, room),
Seq(gathering, user, game, room),
Seq(scalatags, lettuce) ++ reactivemongo.bundle ++ tests.bundle
)

Expand Down
3 changes: 0 additions & 3 deletions modules/chat/src/main/ChatApi.scala
Original file line number Diff line number Diff line change
Expand Up @@ -123,9 +123,6 @@ final class ChatApi(
val line = UserLine(UserName.lichess, None, false, flair = true, text, troll = false, deleted = false)
publishLine(chatId, line, busChan)

def service(chatId: ChatId, text: String, busChan: BusChan.Select, isVolatile: Boolean): Unit =
(if isVolatile then volatile else system) (chatId, text, busChan)

def timeout(
chatId: ChatId,
userId: UserId,
Expand Down
2 changes: 1 addition & 1 deletion modules/swiss/src/main/Env.scala
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ final class Env(
userApi: lila.user.UserApi,
onStart: lila.core.game.OnStart,
socketKit: lila.core.socket.SocketKit,
chatApi: lila.chat.ChatApi,
chat: lila.core.chat.ChatApi,
cacheApi: lila.memo.CacheApi,
lightUserApi: lila.user.LightUserApi,
historyApi: lila.core.history.HistoryApi,
Expand Down
6 changes: 4 additions & 2 deletions modules/swiss/src/main/SwissApi.scala
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ final class SwissApi(
banApi: SwissBanApi,
boardApi: SwissBoardApi,
verify: SwissCondition.Verify,
chatApi: lila.chat.ChatApi,
chatApi: lila.core.chat.ChatApi,
lightUserApi: lila.user.LightUserApi,
roundApi: lila.game.core.RoundApi
)(using scheduler: Scheduler)(using Executor, akka.stream.Materializer)
Expand Down Expand Up @@ -613,7 +613,9 @@ final class SwissApi(
}

private def systemChat(id: SwissId, text: String, volatile: Boolean = false): Unit =
chatApi.userChat.service(id.into(ChatId), text, _.swiss, isVolatile = volatile)
if volatile
then chatApi.volatile(id.into(ChatId), text, _.swiss)
else chatApi.system(id.into(ChatId), text, _.swiss)

def withdrawAll(user: User, teamIds: List[TeamId]): Funit =
mongo.swiss
Expand Down
2 changes: 1 addition & 1 deletion modules/swiss/src/main/SwissSocket.scala
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import lila.core.socket.{ protocol as P, * }

final private class SwissSocket(
socketKit: SocketKit,
chat: lila.chat.ChatApi,
chat: lila.core.chat.ChatApi,
teamOf: SwissId => Fu[Option[TeamId]]
)(using Executor, akka.actor.ActorSystem, Scheduler, lila.core.user.FlairGet):

Expand Down

0 comments on commit 1f9464c

Please sign in to comment.