name boolean arguments
parent
dc1f7978b1
commit
c6ed157217
|
@ -293,7 +293,7 @@ final class Account(
|
|||
implicit val req = ctx.body
|
||||
env.security.forms closeAccount me flatMap { form =>
|
||||
FormFuResult(form) { err =>
|
||||
fuccess(html.account.close(me, err, false))
|
||||
fuccess(html.account.close(me, err, managed = false))
|
||||
} { _ =>
|
||||
env.closeAccount(me.id, self = true) inject {
|
||||
Redirect(routes.User show me.username) withCookies env.lilaCookie.newSession
|
||||
|
@ -326,7 +326,7 @@ final class Account(
|
|||
.fold(
|
||||
err =>
|
||||
negotiate(
|
||||
html = BadRequest(html.account.kid(me, err, false)).fuccess,
|
||||
html = BadRequest(html.account.kid(me, err, managed = false)).fuccess,
|
||||
api = _ => BadRequest(errorsAsJson(err)).fuccess
|
||||
),
|
||||
_ =>
|
||||
|
|
|
@ -323,7 +323,7 @@ final class Auth(
|
|||
|
||||
def passwordReset =
|
||||
Open { implicit ctx =>
|
||||
Ok(renderPasswordReset(none, false)).fuccess
|
||||
Ok(renderPasswordReset(none, fail = false)).fuccess
|
||||
}
|
||||
|
||||
def passwordResetApply =
|
||||
|
@ -332,7 +332,7 @@ final class Auth(
|
|||
forms.passwordReset.form
|
||||
.bindFromRequest()
|
||||
.fold(
|
||||
err => BadRequest(renderPasswordReset(err.some, true)).fuccess,
|
||||
err => BadRequest(renderPasswordReset(err.some, fail = true)).fuccess,
|
||||
data =>
|
||||
env.security.recaptcha.verify(~data.recaptchaResponse, req) flatMap {
|
||||
_ ?? env.user.repo.enabledWithEmail(data.realEmail.normalize)
|
||||
|
@ -345,7 +345,7 @@ final class Auth(
|
|||
}
|
||||
case _ => {
|
||||
lila.mon.user.auth.passwordResetRequest("noEmail").increment()
|
||||
BadRequest(renderPasswordReset(none, true)).fuccess
|
||||
BadRequest(renderPasswordReset(none, fail = true)).fuccess
|
||||
}
|
||||
}
|
||||
)
|
||||
|
@ -407,7 +407,7 @@ final class Auth(
|
|||
|
||||
def magicLink =
|
||||
Open { implicit ctx =>
|
||||
Ok(renderMagicLink(none, false)).fuccess
|
||||
Ok(renderMagicLink(none, fail = false)).fuccess
|
||||
}
|
||||
|
||||
def magicLinkApply =
|
||||
|
@ -416,7 +416,7 @@ final class Auth(
|
|||
forms.magicLink.form
|
||||
.bindFromRequest()
|
||||
.fold(
|
||||
err => BadRequest(renderMagicLink(err.some, true)).fuccess,
|
||||
err => BadRequest(renderMagicLink(err.some, fail = true)).fuccess,
|
||||
data =>
|
||||
env.security.recaptcha.verify(~data.recaptchaResponse, req) flatMap {
|
||||
_ ?? env.user.repo.enabledWithEmail(data.realEmail.normalize)
|
||||
|
@ -431,7 +431,7 @@ final class Auth(
|
|||
}
|
||||
case _ => {
|
||||
lila.mon.user.auth.magicLinkRequest("no_email").increment()
|
||||
BadRequest(renderMagicLink(none, true)).fuccess
|
||||
BadRequest(renderMagicLink(none, fail = true)).fuccess
|
||||
}
|
||||
}
|
||||
)
|
||||
|
|
|
@ -66,7 +66,7 @@ final class Challenge(
|
|||
Ok(html.challenge.theirs(c, json, user, get("color") flatMap chess.Color.apply))
|
||||
},
|
||||
api = _ => Ok(json).fuccess
|
||||
) flatMap withChallengeAnonCookie(mine && c.challengerIsAnon, c, true)
|
||||
) flatMap withChallengeAnonCookie(mine && c.challengerIsAnon, c, owner = true)
|
||||
} dmap env.lilaCookie.ensure(ctx.req)
|
||||
|
||||
private def isMine(challenge: ChallengeModel)(implicit ctx: Context) =
|
||||
|
@ -90,7 +90,7 @@ final class Challenge(
|
|||
negotiate(
|
||||
html = Redirect(routes.Round.watcher(pov.gameId, cc.fold("white")(_.name))).fuccess,
|
||||
api = apiVersion => env.api.roundApi.player(pov, none, apiVersion) map { Ok(_) }
|
||||
) flatMap withChallengeAnonCookie(ctx.isAnon, c, false)
|
||||
) flatMap withChallengeAnonCookie(ctx.isAnon, c, owner = false)
|
||||
case None =>
|
||||
negotiate(
|
||||
html = Redirect(routes.Round.watcher(c.id, cc.fold("white")(_.name))).fuccess,
|
||||
|
|
|
@ -81,7 +81,7 @@ final class ForumPost(env: Env) extends LilaController(env) with ForumController
|
|||
Auth { implicit ctx => me =>
|
||||
postApi.react(id, me, reaction, v) map {
|
||||
_ ?? { post =>
|
||||
Ok(views.html.forum.post.reactions(post, true))
|
||||
Ok(views.html.forum.post.reactions(post, canReact = true))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -561,7 +561,7 @@ abstract private[controllers] class LilaController(val env: Env)
|
|||
case Some(d) =>
|
||||
env.mod.impersonate.impersonating(d.user) map {
|
||||
_.fold[RestoredUser](d.some -> None) { impersonated =>
|
||||
FingerPrintedUser(impersonated, true).some -> d.user.some
|
||||
FingerPrintedUser(impersonated, hasFingerPrint = true).some -> d.user.some
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -268,8 +268,8 @@ final class Mod(
|
|||
}
|
||||
}
|
||||
|
||||
def communicationPublic(username: String) = communications(username, false)
|
||||
def communicationPrivate(username: String) = communications(username, true)
|
||||
def communicationPublic(username: String) = communications(username, priv = false)
|
||||
def communicationPrivate(username: String) = communications(username, priv = true)
|
||||
|
||||
protected[controllers] def redirect(username: String, mod: Boolean = true) =
|
||||
Redirect(userUrl(username, mod))
|
||||
|
@ -296,7 +296,7 @@ final class Mod(
|
|||
else env.report.api.inquiries.spontaneous _
|
||||
f(AsMod(me), Suspect(user)) inject {
|
||||
if (isAppeal) Redirect(routes.Appeal.show(user.username))
|
||||
else redirect(user.username, true)
|
||||
else redirect(user.username, mod = true)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -163,7 +163,7 @@ final class Puzzle(
|
|||
voted <- ctx.me.?? { env.puzzle.api.vote.value(puzzle.id, _) }
|
||||
} yield Ok(
|
||||
Json.obj(
|
||||
"user" -> lila.puzzle.JsonView.infos(false)(infos),
|
||||
"user" -> lila.puzzle.JsonView.infos(isOldMobile = false)(infos),
|
||||
"round" -> lila.puzzle.JsonView.round(round),
|
||||
"voted" -> voted
|
||||
)
|
||||
|
@ -234,7 +234,7 @@ final class Puzzle(
|
|||
infos <- env.puzzle userInfos me2
|
||||
} yield Ok(
|
||||
Json.obj(
|
||||
"user" -> lila.puzzle.JsonView.infos(false)(infos)
|
||||
"user" -> lila.puzzle.JsonView.infos(isOldMobile = false)(infos)
|
||||
)
|
||||
)
|
||||
)
|
||||
|
|
|
@ -86,7 +86,7 @@ final class Report(
|
|||
def thenGoTo =
|
||||
dataOpt.flatMap(_ get "then").flatMap(_.headOption) flatMap {
|
||||
case "back" => HTTPRequest referer ctx.req
|
||||
case "profile" => modC.userUrl(prev.user, true).some
|
||||
case "profile" => modC.userUrl(prev.user, mod = true).some
|
||||
case url => url.some
|
||||
}
|
||||
thenGoTo match {
|
||||
|
@ -129,7 +129,7 @@ final class Report(
|
|||
api.currentCheatReport(lila.report.Suspect(user)) flatMap {
|
||||
_ ?? { report =>
|
||||
api.inquiries.toggle(lila.report.Mod(me), report.id).void
|
||||
} inject modC.redirect(username, true)
|
||||
} inject modC.redirect(username, mod = true)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -54,7 +54,7 @@ final class Setup(
|
|||
Open { implicit ctx =>
|
||||
if (HTTPRequest isXhr ctx.req)
|
||||
fuccess(forms friendFilled get("fen").map(FEN)) flatMap { form =>
|
||||
val validFen = form("fen").value flatMap ValidFen(false)
|
||||
val validFen = form("fen").value flatMap ValidFen(strict = false)
|
||||
userId ?? env.user.repo.named flatMap {
|
||||
case None => Ok(html.setup.forms.friend(form, none, none, validFen)).fuccess
|
||||
case Some(user) =>
|
||||
|
|
|
@ -115,14 +115,14 @@ final class Simul(
|
|||
def accept(simulId: String, userId: String) =
|
||||
Open { implicit ctx =>
|
||||
AsHost(simulId) { simul =>
|
||||
env.simul.api.accept(simul.id, userId, true) inject jsonOkResult
|
||||
env.simul.api.accept(simul.id, userId, v = true) inject jsonOkResult
|
||||
}
|
||||
}
|
||||
|
||||
def reject(simulId: String, userId: String) =
|
||||
Open { implicit ctx =>
|
||||
AsHost(simulId) { simul =>
|
||||
env.simul.api.accept(simul.id, userId, false) inject jsonOkResult
|
||||
env.simul.api.accept(simul.id, userId, v = false) inject jsonOkResult
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -92,7 +92,7 @@ final class Swiss(
|
|||
.fold(
|
||||
err => BadRequest(html.swiss.form.create(err, teamId)).fuccess,
|
||||
data =>
|
||||
tourC.rateLimitCreation(me, false, ctx.req) {
|
||||
tourC.rateLimitCreation(me, isPrivate = false, ctx.req) {
|
||||
env.swiss.api.create(data, me, teamId) map { swiss =>
|
||||
Redirect(routes.Swiss.show(swiss.id.value))
|
||||
}
|
||||
|
@ -113,7 +113,7 @@ final class Swiss(
|
|||
.fold(
|
||||
jsonFormErrorDefaultLang,
|
||||
data =>
|
||||
tourC.rateLimitCreation(me, false, req) {
|
||||
tourC.rateLimitCreation(me, isPrivate = false, req) {
|
||||
JsonOk {
|
||||
env.swiss.api.create(data, me, teamId) map env.swiss.json.api
|
||||
}
|
||||
|
|
|
@ -121,7 +121,7 @@ final class Tournament(
|
|||
shieldOwner <- env.tournament.shieldApi currentOwner tour
|
||||
} yield Ok(html.tournament.show(tour, verdicts, json, chat, streamers, shieldOwner)))
|
||||
}
|
||||
.monSuccess(_.tournament.apiShowPartial(false, HTTPRequest clientName ctx.req)),
|
||||
.monSuccess(_.tournament.apiShowPartial(partial = false, HTTPRequest clientName ctx.req)),
|
||||
api = _ =>
|
||||
tourOption
|
||||
.fold(notFoundJson("No such tournament")) { tour =>
|
||||
|
|
|
@ -25,7 +25,7 @@ object show {
|
|||
csp = bits.csp
|
||||
)(
|
||||
main(cls := "page-menu page-small")(
|
||||
bits.menu(none, false),
|
||||
bits.menu(none, hasActive = false),
|
||||
div(cls := s"blog page-menu__content box post ${~doc.getText("blog.cssClasses")}")(
|
||||
h1(doc.getText("blog.title")),
|
||||
bits.metas(doc),
|
||||
|
|
|
@ -21,7 +21,7 @@ object mine {
|
|||
views.html.base.layout(
|
||||
title = challengeTitle(c),
|
||||
openGraph = challengeOpenGraph(c).some,
|
||||
moreJs = bits.js(c, json, true),
|
||||
moreJs = bits.js(c, json, owner = true),
|
||||
moreCss = cssTag("challenge.page")
|
||||
) {
|
||||
val challengeLink = s"$netBaseUrl${routes.Round.watcher(c.id, "white")}"
|
||||
|
|
|
@ -19,7 +19,7 @@ object theirs {
|
|||
views.html.base.layout(
|
||||
title = challengeTitle(c),
|
||||
openGraph = challengeOpenGraph(c).some,
|
||||
moreJs = bits.js(c, json, false, color),
|
||||
moreJs = bits.js(c, json, owner = false, color),
|
||||
moreCss = cssTag("challenge.page")
|
||||
) {
|
||||
main(cls := "page-small challenge-page challenge-theirs box box-pad")(
|
||||
|
|
|
@ -101,7 +101,7 @@ object clas {
|
|||
innerForm(form, c.some),
|
||||
hr,
|
||||
c.isActive option postForm(
|
||||
action := routes.Clas.archive(c.id.value, true),
|
||||
action := routes.Clas.archive(c.id.value, v = true),
|
||||
cls := "clas-edit__archive"
|
||||
)(
|
||||
form3.submit(trans.clas.closeClass(), icon = none)(
|
||||
|
|
|
@ -33,7 +33,7 @@ object student {
|
|||
s.student.archived map { archived =>
|
||||
div(cls := "student-show__archived archived")(
|
||||
bits.showArchived(archived),
|
||||
postForm(action := routes.Clas.studentArchive(clas.id.value, s.user.username, false))(
|
||||
postForm(action := routes.Clas.studentArchive(clas.id.value, s.user.username, v = false))(
|
||||
form3.submit(trans.clas.inviteTheStudentBack(), icon = none)(cls := "confirm button-empty")
|
||||
)
|
||||
)
|
||||
|
@ -209,7 +209,7 @@ object student {
|
|||
s.student.isActive option frag(
|
||||
hr,
|
||||
postForm(
|
||||
action := routes.Clas.studentArchive(clas.id.value, s.user.username, true),
|
||||
action := routes.Clas.studentArchive(clas.id.value, s.user.username, v = true),
|
||||
cls := "student-show__archive"
|
||||
)(
|
||||
form3.submit(trans.clas.removeStudent(), icon = none)(
|
||||
|
|
|
@ -39,7 +39,7 @@ object teacherDashboard {
|
|||
c.archived map { archived =>
|
||||
div(cls := "clas-show__archived archived")(
|
||||
bits.showArchived(archived),
|
||||
postForm(action := routes.Clas.archive(c.id.value, false))(
|
||||
postForm(action := routes.Clas.archive(c.id.value, v = false))(
|
||||
form3.submit(trans.clas.reopen(), icon = none)(cls := "confirm button-empty")
|
||||
)
|
||||
)
|
||||
|
|
|
@ -106,8 +106,8 @@ object categ {
|
|||
)
|
||||
),
|
||||
tbody(
|
||||
stickyPosts map showTopic(true),
|
||||
topics.currentPageResults map showTopic(false)
|
||||
stickyPosts map showTopic(sticky = true),
|
||||
topics.currentPageResults map showTopic(sticky = false)
|
||||
)
|
||||
),
|
||||
bar
|
||||
|
|
|
@ -83,7 +83,7 @@ object side {
|
|||
game.pgnImport.exists(_.date.isDefined) option small(
|
||||
"Imported ",
|
||||
game.pgnImport.flatMap(_.user).map { user =>
|
||||
trans.by(userIdLink(user.some, None, false))
|
||||
trans.by(userIdLink(user.some, None, withOnline = false))
|
||||
}
|
||||
)
|
||||
)
|
||||
|
@ -94,7 +94,7 @@ object side {
|
|||
div(cls := s"player color-icon is ${p.color.name} text")(
|
||||
playerLink(p, withOnline = false, withDiff = true, withBerserk = true)
|
||||
),
|
||||
tour.flatMap(_.teamVs).map(_.teams(p.color)) map { teamLink(_, false)(cls := "team") }
|
||||
tour.flatMap(_.teamVs).map(_.teams(p.color)) map { teamLink(_, withIcon = false)(cls := "team") }
|
||||
)
|
||||
}
|
||||
)
|
||||
|
|
|
@ -31,7 +31,7 @@ object widgets {
|
|||
frag(
|
||||
span("IMPORT"),
|
||||
g.pgnImport.flatMap(_.user).map { user =>
|
||||
frag(" ", trans.by(userIdLink(user.some, None, false)))
|
||||
frag(" ", trans.by(userIdLink(user.some, None, withOnline = false)))
|
||||
},
|
||||
separator,
|
||||
if (g.variant.exotic) bits.variantLink(g.variant, g.variant.name.toUpperCase)
|
||||
|
@ -138,7 +138,7 @@ object widgets {
|
|||
} getOrElse {
|
||||
player.aiLevel map { level =>
|
||||
frag(
|
||||
span(aiName(level, false)),
|
||||
span(aiName(level, withRating = false)),
|
||||
br,
|
||||
aiRating(level)
|
||||
)
|
||||
|
|
|
@ -30,7 +30,7 @@ object blindLobby {
|
|||
a(href := gameLink(pov))(
|
||||
playerText(pov.opponent),
|
||||
" ",
|
||||
pov.isMyTurn ?? pov.remainingSeconds map { secondsFromNow(_, true) }
|
||||
pov.isMyTurn ?? pov.remainingSeconds map { secondsFromNow(_, alwaysRelative = true) }
|
||||
)
|
||||
)
|
||||
}
|
||||
|
|
|
@ -214,7 +214,7 @@ object inquiry {
|
|||
div(cls := "actions close")(
|
||||
span(cls := "switcher", title := "Automatically open next report")(
|
||||
span(cls := "switch")(
|
||||
form3.cmnToggle("auto-next", "auto-next", true)
|
||||
form3.cmnToggle("auto-next", "auto-next", checked = true)
|
||||
)
|
||||
),
|
||||
postForm(
|
||||
|
|
|
@ -37,8 +37,8 @@ object embed {
|
|||
)
|
||||
),
|
||||
jQueryTag,
|
||||
jsAt("javascripts/vendor/chessground.min.js", false),
|
||||
jsAt("compiled/puzzle.js", false)
|
||||
jsAt("javascripts/vendor/chessground.min.js", defer = false),
|
||||
jsAt("compiled/puzzle.js", defer = false)
|
||||
)
|
||||
)
|
||||
)
|
||||
|
|
|
@ -96,7 +96,7 @@ object bits {
|
|||
"round-toggle-autoswitch" pipe { id =>
|
||||
span(cls := "move-on switcher", st.title := trans.automaticallyProceedToNextGameAfterMoving.txt())(
|
||||
label(`for` := id)(trans.autoSwitch()),
|
||||
span(cls := "switch")(form3.cmnToggle(id, id, false))
|
||||
span(cls := "switch")(form3.cmnToggle(id, id, checked = false))
|
||||
)
|
||||
}
|
||||
),
|
||||
|
@ -110,7 +110,7 @@ object bits {
|
|||
playerText(pov.opponent, withRating = false),
|
||||
span(cls := "indicator")(
|
||||
if (pov.isMyTurn)
|
||||
pov.remainingSeconds.fold[Frag](trans.yourTurn())(secondsFromNow(_, true))
|
||||
pov.remainingSeconds.fold[Frag](trans.yourTurn())(secondsFromNow(_, alwaysRelative = true))
|
||||
else nbsp
|
||||
)
|
||||
)
|
||||
|
|
|
@ -69,7 +69,7 @@ LichessRound.boot(${safeJsonValue(
|
|||
bits.side(pov, data, tour.map(_.tourAndTeamVs), simul, bookmarked = bookmarked),
|
||||
chatOption.map(_ => chat.frag)
|
||||
),
|
||||
bits.roundAppPreload(pov, true),
|
||||
bits.roundAppPreload(pov, controls = true),
|
||||
div(cls := "round__underboard")(
|
||||
bits.crosstable(cross, pov.game),
|
||||
(playing.nonEmpty || simul.exists(_ isHost ctx.me)) option
|
||||
|
|
|
@ -57,7 +57,7 @@ LichessRound.boot(${safeJsonValue(
|
|||
bits.side(pov, data, tour, simul, userTv, bookmarked),
|
||||
chatOption.map(_ => chat.frag)
|
||||
),
|
||||
bits.roundAppPreload(pov, false),
|
||||
bits.roundAppPreload(pov, controls = false),
|
||||
div(cls := "round__underboard")(bits.crosstable(cross, pov.game)),
|
||||
div(cls := "round__underchat")(bits underchat pov.game)
|
||||
)
|
||||
|
|
|
@ -51,7 +51,7 @@ object forms {
|
|||
layout("ai", trans.playWithTheMachine(), routes.Setup.ai()) {
|
||||
frag(
|
||||
renderVariant(form, translatedAiVariantChoices),
|
||||
fenInput(form("fen"), true, validFen),
|
||||
fenInput(form("fen"), strict = true, validFen),
|
||||
renderTimeMode(form),
|
||||
if (ctx.blind)
|
||||
frag(
|
||||
|
@ -95,7 +95,7 @@ object forms {
|
|||
userLink(u, cssClass = "target".some)
|
||||
},
|
||||
renderVariant(form, translatedVariantChoicesWithVariantsAndFen),
|
||||
fenInput(form("fen"), false, validFen),
|
||||
fenInput(form("fen"), strict = false, validFen),
|
||||
renderTimeMode(form),
|
||||
ctx.isAuth option div(cls := "mode_choice buttons")(
|
||||
renderRadios(form("mode"), translatedModeChoices)
|
||||
|
|
|
@ -74,7 +74,7 @@ var d=lichess.StrongSocket.defaults;d.params.flag="tournament";d.events.reload=a
|
|||
scheduled.map { tour =>
|
||||
tour.schedule.filter(s => s.freq != lila.tournament.Schedule.Freq.Hourly) map { s =>
|
||||
a(href := routes.Tournament.show(tour.id), dataIcon := tournamentIconChar(tour))(
|
||||
strong(tour.name(false)),
|
||||
strong(tour.name(full = false)),
|
||||
momentFromNow(s.at)
|
||||
)
|
||||
}
|
||||
|
|
|
@ -31,8 +31,8 @@ object embed {
|
|||
views.html.game.bits.vstext(pov)(none)
|
||||
),
|
||||
jQueryTag,
|
||||
jsAt("javascripts/vendor/chessground.min.js", false),
|
||||
jsAt("compiled/tv.js", false)
|
||||
jsAt("javascripts/vendor/chessground.min.js", defer = false),
|
||||
jsAt("compiled/tv.js", defer = false)
|
||||
)
|
||||
)
|
||||
)
|
||||
|
|
|
@ -51,7 +51,7 @@ object index {
|
|||
side.meta(pov),
|
||||
side.channels(channel, champions, "/tv")
|
||||
),
|
||||
views.html.round.bits.roundAppPreload(pov, false),
|
||||
views.html.round.bits.roundAppPreload(pov, controls = false),
|
||||
div(cls := "round__underboard")(
|
||||
views.html.round.bits.crosstable(cross, pov.game),
|
||||
div(cls := "tv-history")(
|
||||
|
|
|
@ -135,11 +135,11 @@ object header {
|
|||
div(cls := "mod-note")(
|
||||
submitButton(cls := "button")(trans.send()),
|
||||
div(
|
||||
div(form3.cmnToggle("note-mod", "mod", true)),
|
||||
div(form3.cmnToggle("note-mod", "mod", checked = true)),
|
||||
label(`for` := "note-mod")("For moderators only")
|
||||
),
|
||||
isGranted(_.Doxing) option div(
|
||||
div(form3.cmnToggle("note-dox", "dox", false)),
|
||||
div(form3.cmnToggle("note-dox", "dox", checked = false)),
|
||||
label(`for` := "note-dox")("Doxing info")
|
||||
)
|
||||
)
|
||||
|
|
|
@ -29,7 +29,7 @@ final class ActivityWriteApi(
|
|||
.add(pt, Score.make(game wonBy player.color, RatingProg make player))
|
||||
)
|
||||
setCorres = game.hasCorrespondenceClock ?? $doc(
|
||||
ActivityFields.corres -> a.corres.orDefault.add(GameId(game.id), false, true)
|
||||
ActivityFields.corres -> a.corres.orDefault.add(GameId(game.id), moved = false, ended = true)
|
||||
)
|
||||
setters = setGames ++ setCorres
|
||||
_ <-
|
||||
|
@ -89,7 +89,7 @@ final class ActivityWriteApi(
|
|||
|
||||
def corresMove(gameId: Game.ID, userId: User.ID) =
|
||||
update(userId) { a =>
|
||||
a.copy(corres = Some((~a.corres).add(GameId(gameId), true, false))).some
|
||||
a.copy(corres = Some((~a.corres).add(GameId(gameId), moved = true, ended = false))).some
|
||||
}
|
||||
|
||||
def plan(userId: User.ID, months: Int) =
|
||||
|
|
|
@ -43,7 +43,7 @@ final class Annotator(netDomain: lila.common.config.NetDomain) {
|
|||
move =>
|
||||
move.copy(
|
||||
glyphs = Glyphs.fromList(advice.judgment.glyph :: Nil),
|
||||
comments = advice.makeComment(true, true) :: move.comments,
|
||||
comments = advice.makeComment(withEval = true, withBestMove = true) :: move.comments,
|
||||
variations = makeVariation(turn, advice) :: Nil
|
||||
)
|
||||
)
|
||||
|
|
|
@ -20,7 +20,7 @@ object JsonView {
|
|||
Json
|
||||
.obj(
|
||||
"name" -> a.judgment.name,
|
||||
"comment" -> a.makeComment(false, true)
|
||||
"comment" -> a.makeComment(withEval = false, withBestMove = true)
|
||||
)
|
||||
.add(
|
||||
"glyph" -> withGlyph.option(
|
||||
|
|
|
@ -256,7 +256,7 @@ final private[api] class RoundApi(
|
|||
Json
|
||||
.obj(
|
||||
"id" -> v.tour.id,
|
||||
"name" -> v.tour.name(false),
|
||||
"name" -> v.tour.name(full = false),
|
||||
"running" -> v.tour.isStarted
|
||||
)
|
||||
.add("secondsToFinish" -> v.tour.isStarted.option(v.tour.secondsToFinish))
|
||||
|
|
|
@ -50,9 +50,9 @@ final class BotPlayer(
|
|||
chatApi.userChat.write(chatId, me.id, d.text, publicSource = source, _.Round)
|
||||
}
|
||||
|
||||
def rematchAccept(id: Game.ID, me: User): Fu[Boolean] = rematch(id, me, true)
|
||||
def rematchAccept(id: Game.ID, me: User): Fu[Boolean] = rematch(id, me, accept = true)
|
||||
|
||||
def rematchDecline(id: Game.ID, me: User): Fu[Boolean] = rematch(id, me, false)
|
||||
def rematchDecline(id: Game.ID, me: User): Fu[Boolean] = rematch(id, me, accept = false)
|
||||
|
||||
private def rematch(id: Game.ID, me: User, accept: Boolean): Fu[Boolean] =
|
||||
gameRepo game id map {
|
||||
|
|
|
@ -83,7 +83,7 @@ final class GameStateStream(
|
|||
else self ! SetOnline
|
||||
}
|
||||
lila.mon.bot.gameStream("start").increment()
|
||||
Bus.publish(Tell(init.game.id, BotConnected(as, true)), "roundSocket")
|
||||
Bus.publish(Tell(init.game.id, BotConnected(as, v = true)), "roundSocket")
|
||||
}
|
||||
|
||||
override def postStop(): Unit = {
|
||||
|
@ -92,7 +92,7 @@ final class GameStateStream(
|
|||
// hang around if game is over
|
||||
// so the opponent has a chance to rematch
|
||||
context.system.scheduler.scheduleOnce(if (gameOver) 10 second else 1 second) {
|
||||
Bus.publish(Tell(init.game.id, BotConnected(as, false)), "roundSocket")
|
||||
Bus.publish(Tell(init.game.id, BotConnected(as, v = false)), "roundSocket")
|
||||
}
|
||||
queue.complete()
|
||||
lila.mon.bot.gameStream("stop").increment()
|
||||
|
|
|
@ -12,14 +12,14 @@ final class OnlineApiUsers(
|
|||
|
||||
private val cache = new ExpireCallbackMemo(
|
||||
10.seconds,
|
||||
userId => publish(userId, false)
|
||||
userId => publish(userId, isOnline = false)
|
||||
)
|
||||
|
||||
def setOnline(userId: lila.user.User.ID): Unit = {
|
||||
// We must delay the event publication, because caffeine
|
||||
// delays the removal listener, therefore when a bot reconnects,
|
||||
// the offline event is sent after the online event.
|
||||
if (!cache.get(userId)) scheduler.scheduleOnce(1 second) { publish(userId, true) }
|
||||
if (!cache.get(userId)) scheduler.scheduleOnce(1 second) { publish(userId, isOnline = true) }
|
||||
cache.put(userId)
|
||||
}
|
||||
|
||||
|
|
|
@ -42,7 +42,7 @@ final class ChatApi(
|
|||
def findMine(chatId: Chat.Id, me: Option[User]): Fu[UserChat.Mine] =
|
||||
me match {
|
||||
case Some(user) => findMine(chatId, user)
|
||||
case None => cache.get(chatId) dmap { UserChat.Mine(_, false) }
|
||||
case None => cache.get(chatId) dmap { UserChat.Mine(_, timeout = false) }
|
||||
}
|
||||
|
||||
private def findMine(chatId: Chat.Id, me: User): Fu[UserChat.Mine] =
|
||||
|
@ -62,14 +62,14 @@ final class ChatApi(
|
|||
def findAll(chatIds: List[Chat.Id]): Fu[List[UserChat]] =
|
||||
coll.byIds[UserChat](chatIds.map(_.value), ReadPreference.secondaryPreferred)
|
||||
|
||||
def findMine(chatId: Chat.Id, me: Option[User]): Fu[UserChat.Mine] = findMineIf(chatId, me, true)
|
||||
def findMine(chatId: Chat.Id, me: Option[User]): Fu[UserChat.Mine] = findMineIf(chatId, me, cond = true)
|
||||
|
||||
def findMineIf(chatId: Chat.Id, me: Option[User], cond: Boolean): Fu[UserChat.Mine] =
|
||||
me match {
|
||||
case Some(user) if cond => findMine(chatId, user)
|
||||
case Some(user) => fuccess(UserChat.Mine(Chat.makeUser(chatId) forUser user.some, false))
|
||||
case None if cond => find(chatId) dmap { UserChat.Mine(_, false) }
|
||||
case None => fuccess(UserChat.Mine(Chat.makeUser(chatId), false))
|
||||
case Some(user) => fuccess(UserChat.Mine(Chat.makeUser(chatId) forUser user.some, timeout = false))
|
||||
case None if cond => find(chatId) dmap { UserChat.Mine(_, timeout = false) }
|
||||
case None => fuccess(UserChat.Mine(Chat.makeUser(chatId), timeout = false))
|
||||
}
|
||||
|
||||
private def findMine(chatId: Chat.Id, me: User): Fu[UserChat.Mine] =
|
||||
|
@ -243,7 +243,7 @@ final class ChatApi(
|
|||
makeLine(chatId, color, text) ?? { line =>
|
||||
pushLine(chatId, line) >>- {
|
||||
publish(chatId, actorApi.ChatLine(chatId, line), busChan)
|
||||
lila.mon.chat.message("anonPlayer", false).increment()
|
||||
lila.mon.chat.message("anonPlayer", troll = false).increment()
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@ final class ChatPanic {
|
|||
!(enabled || tighter) || {
|
||||
(u.count.gameH > 10 && u.createdSinceDays(1)) || u.isVerified
|
||||
}
|
||||
def allowed(u: User): Boolean = allowed(u, false)
|
||||
def allowed(u: User): Boolean = allowed(u, tighter = false)
|
||||
|
||||
def allowed(id: User.ID, fetch: User.ID => Fu[Option[User]]): Fu[Boolean] =
|
||||
if (enabled) fetch(id) dmap { _ ?? allowed }
|
||||
|
|
|
@ -195,7 +195,7 @@ final class ClasApi(
|
|||
)
|
||||
.orFail(s"No user could be created for ${data.username}")
|
||||
.flatMap { user =>
|
||||
userRepo.setKid(user, true) >>
|
||||
userRepo.setKid(user, v = true) >>
|
||||
userRepo.setManagedUserInitialPerfs(user.id) >>
|
||||
coll.insert.one(Student.make(user, clas, teacher.id, data.realName, managed = true)) >>
|
||||
sendWelcomeMessage(teacher.id, user, clas) inject
|
||||
|
@ -251,7 +251,7 @@ ${clas.desc}""",
|
|||
|
||||
def create(clas: Clas, user: User, realName: String, teacher: User): Fu[ClasInvite.Feedback] =
|
||||
student
|
||||
.archive(Student.id(user.id, clas.id), user, false)
|
||||
.archive(Student.id(user.id, clas.id), user, v = false)
|
||||
.map2[ClasInvite.Feedback](_ => Already) getOrElse {
|
||||
lila.mon.clas.studentInvite(teacher.id)
|
||||
val invite = ClasInvite.make(clas, user, realName, teacher)
|
||||
|
|
|
@ -42,10 +42,10 @@ final class Env(
|
|||
|
||||
lila.common.Bus.subscribeFun("adjustCheater", "finishGame", "shadowban", "setPermissions") {
|
||||
case lila.hub.actorApi.mod.Shadowban(userId, true) =>
|
||||
api.toggleApproved(userId, false)
|
||||
api.toggleApproved(userId, value = false)
|
||||
api.reviews deleteAllBy userId
|
||||
case lila.hub.actorApi.mod.MarkCheater(userId, true) =>
|
||||
api.toggleApproved(userId, false)
|
||||
api.toggleApproved(userId, value = false)
|
||||
api.reviews deleteAllBy userId
|
||||
case lila.hub.actorApi.mod.SetPermissions(userId, permissions) =>
|
||||
api.toggleApproved(userId, permissions.has(Permission.Coach.dbKey))
|
||||
|
@ -60,8 +60,8 @@ final class Env(
|
|||
def cli =
|
||||
new lila.common.Cli {
|
||||
def process = {
|
||||
case "coach" :: "enable" :: username :: Nil => api.toggleApproved(username, true)
|
||||
case "coach" :: "disable" :: username :: Nil => api.toggleApproved(username, false)
|
||||
case "coach" :: "enable" :: username :: Nil => api.toggleApproved(username, value = true)
|
||||
case "coach" :: "disable" :: username :: Nil => api.toggleApproved(username, value = false)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -73,7 +73,7 @@ object WMMatching {
|
|||
|
||||
private[this] def minWeightMatching(endpoint: Array[Int], weights: Array[Int]): List[(Int, Int)] = {
|
||||
val maxweight = weights.max
|
||||
maxWeightMatching(endpoint, weights.map { maxweight - _ }, true)
|
||||
maxWeightMatching(endpoint, weights.map { maxweight - _ }, maxcardinality = true)
|
||||
}
|
||||
|
||||
private[this] def mateToList(endpoint: Array[Int], mate: Array[Int]): List[(Int, Int)] = {
|
||||
|
@ -783,7 +783,7 @@ object WMMatching {
|
|||
true
|
||||
}
|
||||
case 3 => {
|
||||
expandBlossom(dt.extra, false)
|
||||
expandBlossom(dt.extra, endstage = false)
|
||||
true
|
||||
}
|
||||
}
|
||||
|
|
|
@ -179,13 +179,13 @@ trait CollExt { self: dsl with QueryBuilderExt =>
|
|||
coll.update.one(selector, $set(field -> value))
|
||||
|
||||
def updateFieldUnchecked[V: BSONWriter](selector: Bdoc, field: String, value: V): Unit =
|
||||
coll.update(false, writeConcern = WriteConcern.Unacknowledged).one(selector, $set(field -> value))
|
||||
coll.update(ordered = false, writeConcern = WriteConcern.Unacknowledged).one(selector, $set(field -> value))
|
||||
|
||||
def incField(selector: Bdoc, field: String, value: Int = 1) =
|
||||
coll.update.one(selector, $inc(field -> value))
|
||||
|
||||
def incFieldUnchecked(selector: Bdoc, field: String, value: Int = 1): Unit =
|
||||
coll.update(false, writeConcern = WriteConcern.Unacknowledged).one(selector, $inc(field -> value))
|
||||
coll.update(ordered = false, writeConcern = WriteConcern.Unacknowledged).one(selector, $inc(field -> value))
|
||||
|
||||
def unsetField(selector: Bdoc, field: String, multi: Boolean = false) =
|
||||
coll.update.one(selector, $unset(field), multi = multi)
|
||||
|
|
|
@ -62,7 +62,7 @@ final class Analyser(
|
|||
case true => fuFalse
|
||||
case _ => {
|
||||
import req._
|
||||
val sender = Work.Sender(req.userId.some, none, false, system = lila.user.User isOfficial req.userId)
|
||||
val sender = Work.Sender(req.userId.some, none, mod = false, system = lila.user.User isOfficial req.userId)
|
||||
limiter(sender, ignoreConcurrentCheck = true) flatMap { accepted =>
|
||||
if (!accepted) logger.info(s"Study request declined: ${req.studyId}/${req.chapterId} by $sender")
|
||||
accepted ?? {
|
||||
|
|
|
@ -102,7 +102,7 @@ final class Env(
|
|||
)
|
||||
|
||||
private def disable(username: String) =
|
||||
repo toKey username flatMap { repo.enableClient(_, false) }
|
||||
repo toKey username flatMap { repo.enableClient(_, v = false) }
|
||||
|
||||
def cli =
|
||||
new lila.common.Cli {
|
||||
|
@ -115,7 +115,7 @@ final class Env(
|
|||
case "fishnet" :: "client" :: "delete" :: key :: Nil =>
|
||||
repo toKey key flatMap repo.deleteClient inject "done!"
|
||||
case "fishnet" :: "client" :: "enable" :: key :: Nil =>
|
||||
repo toKey key flatMap { repo.enableClient(_, true) } inject "done!"
|
||||
repo toKey key flatMap { repo.enableClient(_, v = true) } inject "done!"
|
||||
case "fishnet" :: "client" :: "disable" :: key :: Nil => disable(key) inject "done!"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -63,8 +63,8 @@ final private class Monitor(
|
|||
val significantPvSizes =
|
||||
result.evaluations.filterNot(_.mateFound).filterNot(_.deadDraw).map(_.pv.size)
|
||||
|
||||
monBy.pv(userId, false).increment(significantPvSizes.count(_ < 3))
|
||||
monBy.pv(userId, true).increment(significantPvSizes.count(_ >= 6))
|
||||
monBy.pv(userId, isLong = false).increment(significantPvSizes.count(_ < 3))
|
||||
monBy.pv(userId, isLong = true).increment(significantPvSizes.count(_ >= 6))
|
||||
}
|
||||
|
||||
private def sample[A](elems: List[A], n: Int) =
|
||||
|
|
|
@ -54,7 +54,7 @@ final class PostApi(
|
|||
case _ =>
|
||||
env.postRepo.coll.insert.one(post) >>
|
||||
env.topicRepo.coll.update.one($id(topic.id), topic withPost post) >> {
|
||||
shouldHideOnPost(topic) ?? env.topicRepo.hide(topic.id, true)
|
||||
shouldHideOnPost(topic) ?? env.topicRepo.hide(topic.id, value = true)
|
||||
} >>
|
||||
env.categRepo.coll.update.one($id(categ.id), categ withTopic post) >>- {
|
||||
(!categ.quiet ?? (indexer ! InsertPost(post)))
|
||||
|
|
|
@ -385,7 +385,7 @@ final class GameRepo(val coll: Coll)(implicit ec: scala.concurrent.ExecutionCont
|
|||
coll.update.one($id(id), $unset(F.checkAt)).void
|
||||
|
||||
def unsetPlayingUids(g: Game): Unit =
|
||||
coll.update(false, WriteConcern.Unacknowledged).one($id(g.id), $unset(F.playingUids))
|
||||
coll.update(ordered = false, WriteConcern.Unacknowledged).one($id(g.id), $unset(F.playingUids))
|
||||
|
||||
// used to make a compound sparse index
|
||||
def setImportCreatedAt(g: Game) =
|
||||
|
|
|
@ -21,7 +21,7 @@ private[game] case class Metadata(
|
|||
|
||||
private[game] object Metadata {
|
||||
|
||||
val empty = Metadata(None, None, None, None, None, false)
|
||||
val empty = Metadata(None, None, None, None, None, analysed = false)
|
||||
}
|
||||
|
||||
case class PgnImport(
|
||||
|
|
|
@ -210,10 +210,10 @@ final class LobbySocket(
|
|||
// entering the hooks view
|
||||
case ("hookIn", _) =>
|
||||
HookPoolLimit(member, cost = 2, msg = "hookIn") {
|
||||
lobby ! HookSub(member, true)
|
||||
lobby ! HookSub(member, value = true)
|
||||
}
|
||||
// leaving the hooks view
|
||||
case ("hookOut", _) => trouper ! HookSub(member, false)
|
||||
case ("hookOut", _) => trouper ! HookSub(member, value = false)
|
||||
}
|
||||
|
||||
private def getOrConnect(sri: Sri, userOpt: Option[User.ID]): Fu[Member] =
|
||||
|
|
|
@ -42,5 +42,5 @@ case class LobbyPerf(rating: Int, provisional: Boolean)
|
|||
|
||||
object LobbyPerf {
|
||||
|
||||
val default = LobbyPerf(Glicko.defaultIntRating, true)
|
||||
val default = LobbyPerf(Glicko.defaultIntRating, provisional = true)
|
||||
}
|
||||
|
|
|
@ -28,7 +28,7 @@ final class MongoCache[K, V: BSONHandler] private (
|
|||
val dbKey = makeDbKey(k)
|
||||
coll.one[Entry]($id(dbKey)) flatMap {
|
||||
case None =>
|
||||
lila.mon.mongoCache.request(name, false).increment()
|
||||
lila.mon.mongoCache.request(name, hit = false).increment()
|
||||
loader(k)
|
||||
.flatMap { v =>
|
||||
coll.update.one(
|
||||
|
@ -39,7 +39,7 @@ final class MongoCache[K, V: BSONHandler] private (
|
|||
}
|
||||
.mon(_.mongoCache.compute(name))
|
||||
case Some(entry) =>
|
||||
lila.mon.mongoCache.request(name, true).increment()
|
||||
lila.mon.mongoCache.request(name, hit = true).increment()
|
||||
fuccess(entry.v)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -94,7 +94,7 @@ final class AssessApi(
|
|||
(gameRepo.gamesForAssessment(user.id, 100) flatMap { gs =>
|
||||
(gs map { g =>
|
||||
analysisRepo.byGame(g) flatMap {
|
||||
_ ?? { onAnalysisReady(g, _, false) }
|
||||
_ ?? { onAnalysisReady(g, _, thenAssessUser = false) }
|
||||
}
|
||||
}).sequenceFu.void
|
||||
}) >> assessUser(user.id)
|
||||
|
|
|
@ -106,7 +106,7 @@ final class Env(
|
|||
case lila.hub.actorApi.security.GCImmediateSb(userId) =>
|
||||
reportApi getSuspect userId orFail s"No such suspect $userId" flatMap { sus =>
|
||||
reportApi.getLichessMod map { mod =>
|
||||
api.setTroll(mod, sus, true)
|
||||
api.setTroll(mod, sus, value = true)
|
||||
}
|
||||
}
|
||||
case lila.hub.actorApi.security.GarbageCollect(userId) =>
|
||||
|
|
|
@ -49,7 +49,7 @@ final class ModApi(
|
|||
reportApi.getMod(modId.value) flatMap {
|
||||
_ ?? { mod =>
|
||||
lila.mon.cheat.autoMark.increment()
|
||||
setEngine(mod, sus, true)
|
||||
setEngine(mod, sus, v = true)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -94,8 +94,8 @@ final class ModApi(
|
|||
def garbageCollect(sus: Suspect): Funit =
|
||||
for {
|
||||
mod <- reportApi.getLichessMod
|
||||
_ <- setAlt(mod, sus, true)
|
||||
_ <- setTroll(mod, sus, false)
|
||||
_ <- setAlt(mod, sus, v = true)
|
||||
_ <- setTroll(mod, sus, value = false)
|
||||
} yield logApi.garbageCollect(mod, sus)
|
||||
|
||||
def disableTwoFactor(mod: String, username: String): Funit =
|
||||
|
|
|
@ -188,7 +188,7 @@ final class MsgApi(
|
|||
contact | LightUser.fallback(thread other user),
|
||||
msgs,
|
||||
lila.relation.Relations(none, none),
|
||||
false
|
||||
postable = false
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -74,7 +74,7 @@ final class JsonView(
|
|||
games <- gameRepo.gameOptionsFromSecondary(puzzles.map(_.gameId))
|
||||
jsons <- (puzzles zip games).collect {
|
||||
case (puzzle, Some(game)) =>
|
||||
gameJson.noCache(game, puzzle.initialPly, true) map { gameJson =>
|
||||
gameJson.noCache(game, puzzle.initialPly, onlyLast = true) map { gameJson =>
|
||||
Json.obj(
|
||||
"game" -> gameJson,
|
||||
"puzzle" -> puzzleJson(puzzle, isOldMobile = false)
|
||||
|
@ -82,7 +82,7 @@ final class JsonView(
|
|||
}
|
||||
}.sequenceFu
|
||||
} yield Json.obj(
|
||||
"user" -> JsonView.infos(false)(userInfos),
|
||||
"user" -> JsonView.infos(isOldMobile = false)(userInfos),
|
||||
"puzzles" -> jsons
|
||||
)
|
||||
|
||||
|
|
|
@ -103,12 +103,12 @@ case object Perf {
|
|||
latest = r dateO "la",
|
||||
recent = r intsD "re"
|
||||
)
|
||||
p.copy(glicko = p.glicko.copy(deviation = Glicko.liveDeviation(p, false)))
|
||||
p.copy(glicko = p.glicko.copy(deviation = Glicko.liveDeviation(p, reverse = false)))
|
||||
}
|
||||
|
||||
def writes(w: BSON.Writer, o: Perf) =
|
||||
BSONDocument(
|
||||
"gl" -> o.glicko.copy(deviation = Glicko.liveDeviation(o, true)),
|
||||
"gl" -> o.glicko.copy(deviation = Glicko.liveDeviation(o, reverse = true)),
|
||||
"nb" -> w.int(o.nb),
|
||||
"re" -> w.listO(o.recent),
|
||||
"la" -> o.latest.map(w.date)
|
||||
|
|
|
@ -104,7 +104,7 @@ final class RelayApi(
|
|||
|
||||
def reset(relay: Relay, by: User): Funit =
|
||||
studyApi.deleteAllChapters(relay.studyId, by) >>
|
||||
requestPlay(relay.id, true)
|
||||
requestPlay(relay.id, v = true)
|
||||
|
||||
def cloneRelay(relay: Relay, by: User): Fu[Relay] =
|
||||
create(
|
||||
|
@ -133,7 +133,7 @@ final class RelayApi(
|
|||
) flatMap {
|
||||
_.map { relay =>
|
||||
logger.info(s"Automatically start $relay")
|
||||
requestPlay(relay.id, true)
|
||||
requestPlay(relay.id, v = true)
|
||||
}.sequenceFu.void
|
||||
}
|
||||
|
||||
|
|
|
@ -113,9 +113,9 @@ object RoomSocket {
|
|||
case ChatLine(id, line: UserLine) =>
|
||||
rooms.tellIfPresent(id.value, NotifyVersion("message", lila.chat.JsonView(line), line.troll))
|
||||
case OnTimeout(id, userId) =>
|
||||
rooms.tellIfPresent(id.value, NotifyVersion("chat_timeout", userId, false))
|
||||
rooms.tellIfPresent(id.value, NotifyVersion("chat_timeout", userId, troll = false))
|
||||
case OnReinstate(id, userId) =>
|
||||
rooms.tellIfPresent(id.value, NotifyVersion("chat_reinstate", userId, false))
|
||||
rooms.tellIfPresent(id.value, NotifyVersion("chat_reinstate", userId, troll = false))
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -8,10 +8,10 @@ import lila.user.User
|
|||
final class Messenger(api: ChatApi) {
|
||||
|
||||
def system(game: Game, message: String): Unit =
|
||||
system(true)(game, message)
|
||||
system(persistent = true)(game, message)
|
||||
|
||||
def volatile(game: Game, message: String): Unit =
|
||||
system(false)(game, message)
|
||||
system(persistent = false)(game, message)
|
||||
|
||||
def system(persistent: Boolean)(game: Game, message: String): Unit = {
|
||||
val apiCall =
|
||||
|
|
|
@ -53,7 +53,7 @@ final private class Player(
|
|||
round ! TooManyPlies
|
||||
fuccess(Nil)
|
||||
case Pov(game, color) if game playableBy color =>
|
||||
applyUci(game, uci, false, botLag)
|
||||
applyUci(game, uci, blur = false, botLag)
|
||||
.fold(errs => fufail(ClientError(errs.toString)), fuccess)
|
||||
.flatMap {
|
||||
case Flagged => finisher.outOfTime(game)
|
||||
|
@ -134,7 +134,7 @@ final private class Player(
|
|||
case (ncg, drop) => ncg -> (Right(drop): MoveOrDrop)
|
||||
}
|
||||
}).map {
|
||||
case (ncg, _) if ncg.clock.exists(_.outOfTime(game.turnColor, false)) => Flagged
|
||||
case (ncg, _) if ncg.clock.exists(_.outOfTime(game.turnColor, withGrace = false)) => Flagged
|
||||
case (newChessGame, moveOrDrop) =>
|
||||
MoveApplied(
|
||||
game.update(newChessGame, moveOrDrop, blur),
|
||||
|
|
|
@ -60,7 +60,7 @@ final private[round] class RoundDuct(
|
|||
def isOnline = offlineSince.isEmpty || botConnected
|
||||
|
||||
def setOnline(on: Boolean): Unit = {
|
||||
isLongGone foreach { _ ?? notifyGone(color, false) }
|
||||
isLongGone foreach { _ ?? notifyGone(color, gone = false) }
|
||||
offlineSince = if (on) None else offlineSince orElse nowMillis.some
|
||||
bye = bye && !on
|
||||
}
|
||||
|
@ -382,7 +382,7 @@ final private[round] class RoundDuct(
|
|||
handle { game =>
|
||||
forecastApi.nextMove(game, lastMove) map { mOpt =>
|
||||
mOpt foreach { move =>
|
||||
this ! HumanPlay(PlayerId(game.player.id), move, false)
|
||||
this ! HumanPlay(PlayerId(game.player.id), move, blur = false)
|
||||
}
|
||||
Nil
|
||||
}
|
||||
|
@ -444,7 +444,7 @@ final private[round] class RoundDuct(
|
|||
if (!getPlayer(c).isOnline && getPlayer(!c).isOnline) {
|
||||
getPlayer(c).showMillisToGone foreach {
|
||||
_ ?? { millis =>
|
||||
if (millis <= 0) notifyGone(c, true)
|
||||
if (millis <= 0) notifyGone(c, gone = true)
|
||||
else if (g.clock.exists(_.remainingTime(c).millis > millis + 3000)) notifyGoneIn(c, millis)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -51,7 +51,7 @@ final private class Takebacker(
|
|||
g.updatePlayer(color, _.removeTakebackProposition)
|
||||
}
|
||||
} inject {
|
||||
List(Event.TakebackOffers(false, false)) -> situation.decline
|
||||
List(Event.TakebackOffers(white = false, black = false)) -> situation.decline
|
||||
}
|
||||
case Pov(game, color) if pov.opponent.isProposingTakeback =>
|
||||
proxy.save {
|
||||
|
@ -60,7 +60,7 @@ final private class Takebacker(
|
|||
g.updatePlayer(!color, _.removeTakebackProposition)
|
||||
}
|
||||
} inject {
|
||||
List(Event.TakebackOffers(false, false)) -> situation.decline
|
||||
List(Event.TakebackOffers(white = false, black = false)) -> situation.decline
|
||||
}
|
||||
case _ => fufail(ClientError("[takebacker] invalid no " + pov))
|
||||
}
|
||||
|
|
|
@ -83,7 +83,7 @@ object TreeBuilder {
|
|||
eval = info map makeEval,
|
||||
glyphs = Glyphs.fromList(advice.map(_.judgment.glyph).toList),
|
||||
comments = Node.Comments {
|
||||
advice.map(_.makeComment(false, true)).toList.map { text =>
|
||||
advice.map(_.makeComment(withEval = false, withBestMove = true)).toList.map { text =>
|
||||
Node.Comment(
|
||||
Node.Comment.Id.make,
|
||||
Node.Comment.Text(text),
|
||||
|
|
|
@ -131,7 +131,7 @@ final class Signup(
|
|||
data.username,
|
||||
passwordHash,
|
||||
email.acceptable,
|
||||
false,
|
||||
blind = false,
|
||||
apiVersion.some,
|
||||
mustConfirmEmail = mustConfirm.value
|
||||
)
|
||||
|
|
|
@ -28,7 +28,7 @@ final private class ExplorerGame(
|
|||
importer(gameId) map {
|
||||
_ ?? { game =>
|
||||
position.node ?? { fromNode =>
|
||||
GameToRoot(game, none, false).pipe { root =>
|
||||
GameToRoot(game, none, withClocks = false).pipe { root =>
|
||||
root.setCommentAt(
|
||||
comment = gameComment(game),
|
||||
path = Path(root.mainline.map(_.id))
|
||||
|
|
|
@ -65,7 +65,7 @@ object ServerEval {
|
|||
chapterRepo.setComments(
|
||||
node.comments + Comment(
|
||||
Comment.Id.make,
|
||||
Comment.Text(adv.makeComment(false, true)),
|
||||
Comment.Text(adv.makeComment(withEval = false, withBestMove = true)),
|
||||
Comment.Author.Lichess
|
||||
)
|
||||
)(chapter, path + node) >>
|
||||
|
|
|
@ -109,7 +109,7 @@ object Study {
|
|||
|
||||
case class Likes(value: Int) extends AnyVal
|
||||
case class Liking(likes: Likes, me: Boolean)
|
||||
val emptyLiking = Liking(Likes(0), false)
|
||||
val emptyLiking = Liking(Likes(0), me = false)
|
||||
|
||||
case class Rank(value: DateTime) extends AnyVal
|
||||
object Rank {
|
||||
|
|
|
@ -316,7 +316,7 @@ final class StudyApi(
|
|||
}
|
||||
.collect {
|
||||
case (node, path) if node.forceVariation =>
|
||||
doForceVariation(Study.WithChapter(study, newChapter), path, false, who)
|
||||
doForceVariation(Study.WithChapter(study, newChapter), path, force = false, who)
|
||||
}
|
||||
.sequenceFu
|
||||
.void
|
||||
|
|
|
@ -36,7 +36,7 @@ final class StudyMultiBoard(
|
|||
cacheApi.scaffeine
|
||||
.refreshAfterWrite(4 seconds)
|
||||
.expireAfterAccess(10 minutes)
|
||||
.buildAsyncFuture[Study.Id, Paginator[ChapterPreview]] { fetch(_, 1, false) }
|
||||
.buildAsyncFuture[Study.Id, Paginator[ChapterPreview]] { fetch(_, 1, playing = false) }
|
||||
|
||||
private def fetch(studyId: Study.Id, page: Int, playing: Boolean): Fu[Paginator[ChapterPreview]] = {
|
||||
|
||||
|
|
|
@ -484,7 +484,7 @@ final class SwissApi(
|
|||
systemChat(s.id, s"Round ${s.round.value} started.")
|
||||
funit
|
||||
case s =>
|
||||
systemChat(s.id, s"Round ${s.round.value} failed.", true)
|
||||
systemChat(s.id, s"Round ${s.round.value} failed.", volatile = true)
|
||||
colls.swiss.update
|
||||
.one($id(s.id), $set("nextRoundAt" -> DateTime.now.plusSeconds(61)))
|
||||
.void
|
||||
|
@ -493,7 +493,7 @@ final class SwissApi(
|
|||
else {
|
||||
if (swiss.startsAt isBefore DateTime.now.minusMinutes(60)) destroy(swiss)
|
||||
else {
|
||||
systemChat(swiss.id, "Not enough players for first round; delaying start.", true)
|
||||
systemChat(swiss.id, "Not enough players for first round; delaying start.", volatile = true)
|
||||
colls.swiss.update
|
||||
.one($id(swiss.id), $set("nextRoundAt" -> DateTime.now.plusSeconds(121)))
|
||||
.void
|
||||
|
|
|
@ -164,7 +164,7 @@ object SwissJson {
|
|||
})
|
||||
|
||||
private[swiss] def playerJson(swiss: Swiss, view: SwissPlayer.View): JsObject =
|
||||
playerJsonBase(view, false) ++ Json
|
||||
playerJsonBase(view, performance = false) ++ Json
|
||||
.obj(
|
||||
"sheetMin" -> swiss.allRounds
|
||||
.map(view.pairings.get)
|
||||
|
@ -176,7 +176,7 @@ object SwissJson {
|
|||
)
|
||||
|
||||
def playerJsonExt(swiss: Swiss, view: SwissPlayer.ViewExt): JsObject =
|
||||
playerJsonBase(view, true) ++ Json.obj(
|
||||
playerJsonBase(view, performance = true) ++ Json.obj(
|
||||
"sheet" -> swiss.allRounds
|
||||
.zip(view.sheet.outcomes)
|
||||
.reverse
|
||||
|
|
|
@ -54,7 +54,7 @@ final class PairingRepo(coll: Coll)(implicit ec: scala.concurrent.ExecutionConte
|
|||
}
|
||||
.takeWhile(
|
||||
r => r.size < nbUsers,
|
||||
true
|
||||
inclusive = true
|
||||
)
|
||||
.toMat(Sink.lastOption)(Keep.right)
|
||||
.run()
|
||||
|
|
|
@ -200,7 +200,7 @@ object Tournament {
|
|||
def scheduleAs(sched: Schedule, minutes: Int) =
|
||||
Tournament(
|
||||
id = makeId,
|
||||
name = sched.name(false)(defaultLang),
|
||||
name = sched.name(full = false)(defaultLang),
|
||||
status = Status.Created,
|
||||
clock = Schedule clockFor sched,
|
||||
minutes = minutes,
|
||||
|
|
|
@ -71,7 +71,7 @@ final private[tournament] class PairingSystem(
|
|||
preps.zip(ids).map {
|
||||
case (prep, id) =>
|
||||
//color was chosen in prepWithColor function
|
||||
prep.toPairing(id)(true)
|
||||
prep.toPairing(id)(firstGetsWhite = true)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -34,7 +34,7 @@ final class LightUserApi(
|
|||
name = "user.light",
|
||||
initialCapacity = 131072,
|
||||
compute = id => repo.coll.find($id(id), projection).one[LightUser],
|
||||
default = id => LightUser(id, id, None, false).some,
|
||||
default = id => LightUser(id, id, None, isPatron = false).some,
|
||||
strategy = Syncache.WaitAfterUptime(8 millis),
|
||||
expireAfter = Syncache.ExpireAfterWrite(20 minutes)
|
||||
)
|
||||
|
|
|
@ -91,7 +91,7 @@ final class NoteApi(
|
|||
def lichessWrite(to: User, text: String) =
|
||||
userRepo.lichess flatMap {
|
||||
_ ?? {
|
||||
write(to, text, _, true, false)
|
||||
write(to, text, _, modOnly = true, dox = false)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -33,8 +33,8 @@ case class Plan(
|
|||
|
||||
object Plan {
|
||||
|
||||
val empty = Plan(0, false, none)
|
||||
def start = Plan(1, true, DateTime.now.some)
|
||||
val empty = Plan(0, active = false, none)
|
||||
def start = Plan(1, active = true, DateTime.now.some)
|
||||
|
||||
import lila.db.dsl._
|
||||
private[user] val planBSONHandler = reactivemongo.api.bson.Macros.handler[Plan]
|
||||
|
|
|
@ -157,7 +157,7 @@ final class UserRepo(val coll: Coll)(implicit ec: scala.concurrent.ExecutionCont
|
|||
|
||||
def incColor(userId: User.ID, value: Int): Unit =
|
||||
coll
|
||||
.update(false, WriteConcern.Unacknowledged)
|
||||
.update(ordered = false, WriteConcern.Unacknowledged)
|
||||
.one(
|
||||
$id(userId) ++ (value < 0).??($doc(F.colorIt $gt -3)),
|
||||
$inc(F.colorIt -> value)
|
||||
|
|
|
@ -30,7 +30,7 @@ final private[video] class VideoApi(
|
|||
userOption match {
|
||||
case None =>
|
||||
fuccess {
|
||||
videos map { VideoView(_, false) }
|
||||
videos map { VideoView(_, view = false) }
|
||||
}
|
||||
case Some(user) =>
|
||||
view.seenVideoIds(user, videos) map { ids =>
|
||||
|
|
Loading…
Reference in New Issue