optional tighter panic mode
This commit is contained in:
parent
7e9635ae66
commit
c530e08812
|
@ -75,7 +75,7 @@ object Tournament extends LilaController {
|
|||
private[controllers] def canHaveChat(tour: Tour)(implicit ctx: Context): Boolean = ctx.me ?? { u =>
|
||||
if (ctx.kid) false
|
||||
else if (tour.isPrivate) true
|
||||
else Env.chat.panic allowed u
|
||||
else Env.chat.panic.allowed(u, tighter = tour.variant == chess.variant.Antichess)
|
||||
}
|
||||
|
||||
def show(id: String) = Open { implicit ctx =>
|
||||
|
|
|
@ -8,9 +8,10 @@ final class ChatPanic {
|
|||
|
||||
private var until: Option[DateTime] = none
|
||||
|
||||
def allowed(u: User) = !enabled || {
|
||||
def allowed(u: User, tighter: Boolean): Boolean = !(enabled || tighter) || {
|
||||
u.count.game > 10 && u.createdSinceDays(1)
|
||||
}
|
||||
def allowed(u: User): Boolean = allowed(u, false)
|
||||
|
||||
def enabled = until exists { d =>
|
||||
(d isAfter DateTime.now) || {
|
||||
|
|
Loading…
Reference in a new issue