Skip to content

Commit

Permalink
Merge pull request #3813 from isaacl/playbanFix
Browse files Browse the repository at this point in the history
Don't record playban if in effect
  • Loading branch information
ornicar committed Nov 21, 2017
2 parents db566a2 + c599a2b commit 9678cbe
Showing 1 changed file with 15 additions and 12 deletions.
27 changes: 15 additions & 12 deletions modules/playban/src/main/PlaybanApi.scala
Expand Up @@ -156,19 +156,22 @@ final class PlaybanApi(

private def legiferate(record: UserRecord): Funit = {
record.bannable ?? { ban =>
lila.mon.playban.ban.count()
lila.mon.playban.ban.mins(ban.mins)
bus.publish(lila.hub.actorApi.playban.Playban(record.userId, ban.mins), 'playban)
(!record.banInEffect) ?? coll.update(
$id(record.userId),
$unset("o") ++
$push(
"b" -> $doc(
"$each" -> List(ban),
"$slice" -> -30
(!record.banInEffect) ?? {
lila.mon.playban.ban.count()
lila.mon.playban.ban.mins(ban.mins)
bus.publish(lila.hub.actorApi.playban.Playban(record.userId, ban.mins), 'playban)
coll.update(
$id(record.userId),
$unset("o") ++
$push(
"b" -> $doc(
"$each" -> List(ban),
"$slice" -> -30
)
)
)
).void
).void
}

}
}
}

0 comments on commit 9678cbe

Please sign in to comment.