type safety
parent
a0a2b44e1e
commit
30483dae9b
|
@ -6,7 +6,7 @@ import lila.event.Event
|
|||
import lila.forum.MiniForumPost
|
||||
import lila.game.{ Game, Pov }
|
||||
import lila.playban.TempBan
|
||||
import lila.simul.Simul
|
||||
import lila.simul.{ Simul, SimulIsFeaturable }
|
||||
import lila.streamer.LiveStreams
|
||||
import lila.timeline.Entry
|
||||
import lila.tournament.{ Tournament, Winner }
|
||||
|
@ -27,7 +27,7 @@ final class Preload(
|
|||
playbanApi: lila.playban.PlaybanApi,
|
||||
lightUserApi: LightUserApi,
|
||||
roundProxy: lila.round.GameProxyRepo,
|
||||
simulIsFeaturable: Simul => Boolean,
|
||||
simulIsFeaturable: SimulIsFeaturable,
|
||||
lastPostCache: lila.blog.LastPostCache
|
||||
)(implicit ec: scala.concurrent.ExecutionContext) {
|
||||
|
||||
|
|
|
@ -56,7 +56,7 @@ final class Env(
|
|||
.buildAsyncFuture(_ => repo.allCreatedFeaturable)
|
||||
}
|
||||
|
||||
val featurable = (simul: Simul) => featureLimiter(simul.hostId)(true)
|
||||
val featurable = new SimulIsFeaturable((simul: Simul) => featureLimiter(simul.hostId)(true))
|
||||
|
||||
private val featureLimiter = new lila.memo.RateLimit[lila.user.User.ID](
|
||||
credits = config.featureViews.value,
|
||||
|
@ -91,3 +91,7 @@ final class Env(
|
|||
}
|
||||
)
|
||||
}
|
||||
|
||||
final class SimulIsFeaturable(f: Simul => Boolean) extends (Simul => Boolean) {
|
||||
def apply(simul: Simul) = f(simul)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue