fix propagation of chat timeout events

pull/8210/head
Thibault Duplessis 2021-02-18 12:43:33 +01:00
parent 9a0b9b06d6
commit 7d5e0c2473
5 changed files with 11 additions and 13 deletions

View File

@ -274,7 +274,6 @@ mod {
}
boosting.nb_games_to_mark = 5
boosting.ratio_games_to_mark = 0.01
actor.name = mod
}
report {
collection.report = report2
@ -481,7 +480,6 @@ hub {
bookmark = ${bookmark.actor.name}
report = ${report.actor.name}
shutup = ${shutup.actor.name}
mod = ${mod.actor.name}
chat = ${chat.actor.name}
notify = ${notify.actor.name}
}

View File

@ -19,7 +19,6 @@ final class ChatApi(
flood: lila.security.Flood,
spam: lila.security.Spam,
shutup: lila.hub.actors.Shutup,
modActor: lila.hub.actors.Mod,
cacheApi: lila.memo.CacheApi,
maxLinesPerChat: Chat.MaxLines,
netDomain: NetDomain
@ -182,11 +181,14 @@ final class ChatApi(
publish(chat.id, actorApi.ChatLine(chat.id, l), busChan)
}
if (isMod(mod))
modActor ! lila.hub.actorApi.mod.ChatTimeout(
mod = mod.id,
user = user.id,
reason = reason.key,
text = text
lila.common.Bus.publish(
lila.hub.actorApi.mod.ChatTimeout(
mod = mod.id,
user = user.id,
reason = reason.key,
text = text
),
"chatTimeout"
)
else logger.info(s"${mod.username} times out ${user.username} in #${c.id} for ${reason.key}")
}

View File

@ -26,7 +26,6 @@ final class Env(
flood: lila.security.Flood,
spam: lila.security.Spam,
shutup: lila.hub.actors.Shutup,
mod: lila.hub.actors.Mod,
cacheApi: lila.memo.CacheApi
)(implicit
ec: scala.concurrent.ExecutionContext,
@ -49,7 +48,6 @@ final class Env(
flood = flood,
spam = spam,
shutup = shutup,
modActor = mod,
cacheApi = cacheApi,
maxLinesPerChat = maxLines,
netDomain = netDomain

View File

@ -17,7 +17,6 @@ object actors {
case class TournamentApi(actor: ActorSelection) extends Actor
case class Bookmark(actor: ActorSelection) extends Actor
case class Shutup(actor: ActorSelection) extends Actor
case class Mod(actor: ActorSelection) extends Actor
case class Notification(actor: ActorSelection) extends Actor
case class Timeline(actor: ActorSelection) extends Actor
case class Report(actor: ActorSelection) extends Actor
@ -46,7 +45,6 @@ final class Env(
val bookmark = Bookmark(select("actor.bookmark"))
val report = Report(select("actor.report"))
val shutup = Shutup(select("actor.shutup"))
val mod = Mod(select("actor.mod"))
val notification = Notification(select("actor.notify"))
private def select(name: String) =

View File

@ -13,7 +13,6 @@ private class ModConfig(
@ConfigName("collection.player_assessment") val assessmentColl: CollName,
@ConfigName("collection.modlog") val modlogColl: CollName,
@ConfigName("collection.gaming_history") val gamingHistoryColl: CollName,
@ConfigName("actor.name") val actorName: String,
@ConfigName("boosting.nb_games_to_mark") val boostingNbGamesToMark: Int,
@ConfigName("boosting.ratio_games_to_mark") val boostingRatioToMark: Int
)
@ -114,6 +113,9 @@ final class Env(
},
"autoWarning" -> { case lila.hub.actorApi.mod.AutoWarning(userId, subject) =>
logApi.modMessage(User.lichessId, userId, subject).unit
},
"chatTimeout" -> { case lila.hub.actorApi.mod.ChatTimeout(mod, user, reason, text) =>
logApi.chatTimeout(mod, user, reason, text).unit
}
)
}