allow anons to filter rated games
This commit is contained in:
parent
ad1c8cf32b
commit
e18cc62028
|
@ -7,7 +7,7 @@ import controllers.routes
|
|||
|
||||
trait AssetHelper {
|
||||
|
||||
val assetVersion = 61
|
||||
val assetVersion = 62
|
||||
|
||||
def cssTag(name: String) = css("stylesheets/" + name)
|
||||
|
||||
|
|
|
@ -11,8 +11,6 @@ case class FilterConfig(
|
|||
speed: Option[Speed],
|
||||
eloDiff: Option[Int]) {
|
||||
|
||||
def withModeCasual = copy(mode = Mode.Casual.some)
|
||||
|
||||
def encode = RawFilterConfig(
|
||||
v = ~variant.map(_.id),
|
||||
m = mode.map(_.id) | -1,
|
||||
|
|
|
@ -20,15 +20,13 @@ private[setup] final class FormFactory {
|
|||
def filter(ctx: Context) = Form(
|
||||
mapping(
|
||||
"variant" -> optional(variant),
|
||||
"mode" -> mode(ctx.isAuth),
|
||||
"mode" -> mode(true),
|
||||
"speed" -> optional(speed),
|
||||
"eloDiff" -> optional(eloDiff)
|
||||
)(FilterConfig.<<)(_.>>)
|
||||
)
|
||||
|
||||
def filterConfig(implicit ctx: Context): Fu[FilterConfig] = savedConfig map { config ⇒
|
||||
ctx.isAuth.fold(config.filter, config.filter.withModeCasual)
|
||||
}
|
||||
def filterConfig(implicit ctx: Context): Fu[FilterConfig] = savedConfig map (_.filter)
|
||||
|
||||
def aiFilled(fen: Option[String])(implicit ctx: Context): Fu[Form[AiConfig]] =
|
||||
aiConfig map { config ⇒
|
||||
|
|
|
@ -2084,7 +2084,7 @@ var lichess_sri = Math.random().toString(36).substring(5); // 8 chars
|
|||
function addHook(hook, inBatch) {
|
||||
if (!isRegistered && hook.mode == "Rated") hook.action = 'register';
|
||||
else hook.action = hook.uid == lichess_sri ? "cancel" : "join";
|
||||
if (hook.action == 'join' && hook.emin && (myElo < parseInt(hook.emin) || myElo > parseInt(hook.emax))) return;
|
||||
if (hook.action == 'join' && hook.emin && myElo && (myElo < parseInt(hook.emin) || myElo > parseInt(hook.emax))) return;
|
||||
pool.push(hook);
|
||||
drawHooks(inBatch || false);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue