Skip to content

Commit

Permalink
no longer close related report when timing out a chat line
Browse files Browse the repository at this point in the history
  • Loading branch information
ornicar committed Feb 7, 2025
1 parent 471fe5f commit ea5b0ee
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 16 deletions.
2 changes: 1 addition & 1 deletion modules/core/src/main/security.scala
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import lila.core.userId.{ UserId, UserName, MyId }

case class GarbageCollect(userId: UserId)
case class CloseAccount(userId: UserId)
case class DeletePublicChats(userId: UserId)(using val me: MyId)
case class DeletePublicChats(userId: UserId)

trait LilaCookie:
import play.api.mvc.*
Expand Down
5 changes: 2 additions & 3 deletions modules/mod/src/main/Env.scala
Original file line number Diff line number Diff line change
Expand Up @@ -97,9 +97,8 @@ final class Env(
"analysisReady" -> { case lila.analyse.actorApi.AnalysisReady(game, analysis) =>
assessApi.onAnalysisReady(game, analysis)
},
"deletePublicChats" -> { case d: lila.core.security.DeletePublicChats =>
publicChat.deleteAll(d.userId)
reportApi.autoProcessRecentChatFlags(SuspectId(d.userId))(using d.me)
"deletePublicChats" -> { case lila.core.security.DeletePublicChats(u) =>
publicChat.deleteAll(u)
},
"autoWarning" -> { case lila.core.mod.AutoWarning(userId, subject) =>
logApi.modMessage(userId, subject)(using UserId.lichessAsMe)
Expand Down
12 changes: 0 additions & 12 deletions modules/report/src/main/ReportApi.scala
Original file line number Diff line number Diff line change
Expand Up @@ -294,18 +294,6 @@ final class ReportApi(
for _ <- doProcessReport(selector, unsetInquiry = true)
yield onReportClose()

def autoProcessRecentChatFlags(sus: SuspectId)(using MyId): Funit = for
opt <- coll.one[Report]:
$doc(
"user" -> sus.value,
"room" -> Room.Comm,
"open" -> true
)
rep = opt.filter(_.atoms.toList.forall(_.isFlag))
_ <- rep.so: r =>
doProcessReport($id(r.id), unsetInquiry = true)
yield if rep.isDefined then onReportClose()

private def onReportClose() =
maxScoreCache.invalidateUnit()
lila.mon.mod.report.close.increment()
Expand Down

0 comments on commit ea5b0ee

Please sign in to comment.