Skip to content

Commit

Permalink
Merge branch 'master' into have-f-change-editor-orientation
Browse files Browse the repository at this point in the history
  • Loading branch information
johndoknjas authored Feb 1, 2025
2 parents 1d20ca4 + 25d4d94 commit 2062334
Show file tree
Hide file tree
Showing 354 changed files with 474 additions and 546 deletions.
4 changes: 2 additions & 2 deletions app/controllers/Auth.scala
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,7 @@ final class Auth(
err => renderPasswordReset(err.some, fail = true).map { BadRequest(_) },
data =>
env.user.repo.enabledWithEmail(data.email.normalize).flatMap {
case Some((user, storedEmail)) =>
case Some(user, storedEmail) =>
lila.mon.user.auth.passwordResetRequest("success").increment()
env.security.passwordReset
.send(user, storedEmail)
Expand Down Expand Up @@ -412,7 +412,7 @@ final class Auth(
err => BadRequest.async(renderMagicLink(err.some, fail = true)),
data =>
env.user.repo.enabledWithEmail(data.email.normalize).flatMap {
case Some((user, storedEmail)) =>
case Some(user, storedEmail) =>
env.security.magicLink.rateLimit[Result](user, storedEmail, ctx.req, rateLimited):
lila.mon.user.auth.magicLinkRequest("success").increment()
env.security.magicLink
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/Mod.scala
Original file line number Diff line number Diff line change
Expand Up @@ -384,7 +384,7 @@ final class Mod(

def gdprErase(username: UserStr) = Secure(_.GdprErase) { _ ?=> _ ?=>
Found(env.user.repo.byId(username)): user =>
for _ <- env.api.accountTermination.scheduleErase(user)
for _ <- env.api.accountTermination.scheduleDelete(user)
yield Redirect(routes.User.show(username)).flashSuccess("Erasure scheduled")
}

Expand Down
8 changes: 4 additions & 4 deletions app/controllers/Puzzle.scala
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ final class Puzzle(env: Env, apiC: => Api) extends LilaController(env):
next <- env.puzzle.replay(me, replayDays.some, theme)
json <- next match
case None => fuccess(Json.obj("replayComplete" -> true))
case Some((puzzle, replay)) =>
case Some(puzzle, replay) =>
renderJson(puzzle, angle, replay.some).map { nextJson =>
Json.obj(
"round" -> env.puzzle.jsonView.roundJson.web(round, perf)(using
Expand Down Expand Up @@ -411,8 +411,8 @@ final class Puzzle(env: Env, apiC: => Api) extends LilaController(env):
val theme = PuzzleTheme.findOrMix(themeKey)
val checkedDayOpt = lila.puzzle.PuzzleDashboard.getClosestDay(days)
env.puzzle.replay(me, checkedDayOpt, theme.key).flatMap {
case None => Redirect(routes.Puzzle.dashboard(days, "home", none))
case Some((puzzle, replay)) => renderShow(puzzle, PuzzleAngle(theme), replay = replay.some)
case None => Redirect(routes.Puzzle.dashboard(days, "home", none))
case Some(puzzle, replay) => renderShow(puzzle, PuzzleAngle(theme), replay = replay.some)
}
}

Expand Down Expand Up @@ -510,7 +510,7 @@ final class Puzzle(env: Env, apiC: => Api) extends LilaController(env):
.map:
case None =>
Ok(env.puzzle.jsonView.bc.userJson(perf.intRating))
case Some((round, newPerf)) =>
case Some(round, newPerf) =>
env.puzzle.session.onComplete(round, PuzzleAngle.mix)
Ok(env.puzzle.jsonView.bc.userJson(newPerf.intRating))
)
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/RelayTour.scala
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ final class RelayTour(env: Env, apiC: => Api, roundC: => RelayRound) extends Lil
_.map(_.withTour(tour)).fold(emptyBroadcastPage(tour))(roundC.embedShow)

private def emptyBroadcastPage(tour: TourModel)(using Context) = for
owner <- env.user.lightUser(tour.ownerId)
owner <- env.user.lightUser(tour.ownerIds.head)
markup = tour.markup.map(env.relay.markup(tour))
page <- Ok.page(views.relay.tour.showEmpty(tour, owner, markup))
yield page
Expand Down
92 changes: 36 additions & 56 deletions bin/mongodb/indexes.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,16 +27,16 @@ db.report2.createIndex(
db.report2.createIndex({ user: 1 });
db.report2.createIndex({ 'atoms.by': 1 });
db.report2.createIndex({ room: 1, 'atoms.0.at': -1 });
db.report2.createIndex({ 'atoms.0.at': -1 }, { background: 1 });
db.report2.createIndex({ 'atoms.0.at': -1 });
db.report2.createIndex({ 'done.at': -1 }, { partialFilterExpression: { open: false } });
db.firewall.createIndex({ date: 1 }, { expireAfterSeconds: 7776000, background: true });
db.firewall.createIndex({ date: 1 }, { expireAfterSeconds: 7776000 });
db.timeline_entry.createIndex({ users: 1, date: -1 });
db.timeline_entry.createIndex({ typ: 1, date: -1 });
db.notify.createIndex({ notifies: 1, read: 1, createdAt: -1 });
db.notify.createIndex({ createdAt: 1 }, { expireAfterSeconds: 2592000 });
db.tournament_pairing.createIndex({ tid: 1, d: -1 });
db.tournament_pairing.createIndex({ tid: 1, u: 1, d: -1 });
db.tournament_pairing.createIndex({ tid: 1 }, { partialFilterExpression: { s: { $lt: 30 } }, background: 1 });
db.tournament_pairing.createIndex({ tid: 1 }, { partialFilterExpression: { s: { $lt: 30 } } });
db.round_history.createIndex({ d: 1 }, { expireAfterSeconds: 3600 });
db.relay_tour.createIndex(
{ active: 1, tier: 1 },
Expand Down Expand Up @@ -64,11 +64,8 @@ db.irwin_request.createIndex({ priority: 1 });
db.irwin_request.createIndex({ createdAt: 1 }, { expireAfterSeconds: 1296000 });
db.tournament2.createIndex({ status: 1 });
db.tournament2.createIndex({ startsAt: 1 });
db.tournament2.createIndex({ 'schedule.freq': 1, startsAt: -1 }, { background: true });
db.tournament2.createIndex(
{ status: 1, startsAt: 1 },
{ partialFilterExpression: { status: 10 }, background: 1 },
);
db.tournament2.createIndex({ 'schedule.freq': 1, startsAt: -1 });
db.tournament2.createIndex({ status: 1, startsAt: 1 }, { partialFilterExpression: { status: 10 } });
db.tournament2.createIndex(
{ forTeams: 1, startsAt: -1 },
{ partialFilterExpression: { forTeams: { $exists: 1 } } },
Expand All @@ -88,7 +85,8 @@ db.fide_player.createIndex(
{ _fts: 'text', _ftsx: 1, standard: -1 },
{ weights: { token: 1 }, default_language: 'english', language_override: 'language', textIndexVersion: 3 },
);
db.note.createIndex({ to: 1, date: -1 }, { background: 1 });
db.note.createIndex({ to: 1, date: -1 });
db.note.createIndex({ from: 1 }, { partialFilterExpression: { mod: false } });
db.note.createIndex(
{ _fts: 'text', _ftsx: 1, dox: 1, date: -1 },
{
Expand All @@ -103,16 +101,16 @@ db.irwin_report.createIndex({ date: -1 });
db.user4.createIndex({ 'count.game': -1 });
db.user4.createIndex({ title: 1 }, { partialFilterExpression: { title: { $exists: 1 } } });
db.user4.createIndex({ email: 1 }, { unique: true, partialFilterExpression: { email: { $exists: 1 } } });
db.user4.createIndex({ roles: 1 }, { background: 1, partialFilterExpression: { roles: { $exists: 1 } } });
db.user4.createIndex({ prevEmail: 1 }, { sparse: 1, background: 1 });
db.user4.createIndex({ roles: 1 }, { partialFilterExpression: { roles: { $exists: 1 } } });
db.user4.createIndex({ prevEmail: 1 }, { sparse: 1 });
db.user4.createIndex(
{ 'delete.requested': 1 },
{ partialFilterExpression: { 'delete.requested': { $exists: 1 }, 'delete.done': false } },
);
db.f_topic.createIndex({ categId: 1, troll: 1 });
db.f_topic.createIndex({ categId: 1, updatedAt: -1, troll: 1 });
db.f_topic.createIndex({ categId: 1, slug: 1 });
db.f_topic.createIndex({ categId: 1 }, { partialFilterExpression: { sticky: true }, background: true });
db.f_topic.createIndex({ categId: 1 }, { partialFilterExpression: { sticky: true } });
db.seek_archive.createIndex({ archivedAt: 1 }, { expireAfterSeconds: 604800 });
db.seek_archive.createIndex({ gameId: 1 });
db.swiss_player.createIndex({ s: 1, c: -1 });
Expand All @@ -131,28 +129,28 @@ db.donation.createIndex({ payPalTnx: 1 }, { unique: true, sparse: 1 });
db.donation.createIndex({ userId: 1 });
db.donation.createIndex({ date: -1 });
db.donation.createIndex({ gross: -1 });
db.player_assessment.createIndex({ userId: 1, date: -1 }, { background: 1 });
db.player_assessment.createIndex({ date: 1 }, { expireAfterSeconds: 15552000, background: true });
db.player_assessment.createIndex({ userId: 1, date: -1 });
db.player_assessment.createIndex({ date: 1 }, { expireAfterSeconds: 15552000 });
db.fishnet_analysis.createIndex({ 'sender.system': 1, createdAt: 1 });
db.fishnet_analysis.createIndex({ 'game.id': 1 }, { background: true });
db.fishnet_analysis.createIndex({ 'sender.userId': 1 }, { background: 1 });
db.fishnet_analysis.createIndex({ 'sender.ip': 1 }, { background: 1 });
db.fishnet_analysis.createIndex({ 'sender.system': 1 }, { background: 1 });
db.fishnet_analysis.createIndex({ 'game.id': 1 });
db.fishnet_analysis.createIndex({ 'sender.userId': 1 });
db.fishnet_analysis.createIndex({ 'sender.ip': 1 });
db.fishnet_analysis.createIndex({ 'sender.system': 1 });
db.fishnet_analysis.createIndex(
{ acquired: 1 },
{ partialFilterExpression: { acquired: { $exists: true } }, background: 1 },
{ partialFilterExpression: { acquired: { $exists: true } } },
);
db.bookmark.createIndex({ g: 1 });
db.bookmark.createIndex({ u: 1 });
db.bookmark.createIndex({ u: 1, d: -1 });
db.f_categ.createIndex({ team: 1 });
db.relay_group.createIndex({ tours: 1 });
db.seek.createIndex({ createdAt: -1 }, { expireAfterSeconds: 86400 });
db.msg_msg.createIndex({ tid: 1, date: -1 }, { background: 1 });
db.msg_msg.createIndex({ tid: 1, date: -1 });
db.team.createIndex({ enabled: 1, nbMembers: -1 });
db.team.createIndex({ createdAt: -1 });
db.team.createIndex({ createdBy: 1 });
db.team.createIndex({ leaders: 1 }, { background: 1 });
db.team.createIndex({ leaders: 1 });
db.swiss.createIndex({ teamId: 1, startsAt: 1 });
db.swiss.createIndex({ nextRoundAt: 1 }, { partialFilterExpression: { nextRoundAt: { $exists: true } } });
db.swiss.createIndex(
Expand Down Expand Up @@ -184,7 +182,7 @@ db.chat_timeout.createIndex(
{ chat: 1, expiresAt: -1 },
{ partialFilterExpression: { expiresAt: { $exists: 1 } } },
);
db.chat_timeout.createIndex({ user: 1, createdAt: -1 }, { background: 1 });
db.chat_timeout.createIndex({ user: 1, createdAt: -1 });
db.daily_feed.createIndex({ at: -1 });
db.tournament_leaderboard.createIndex({ t: 1 });
db.tournament_leaderboard.createIndex({ u: 1, d: -1 });
Expand Down Expand Up @@ -213,11 +211,8 @@ db.oauth2_access_token.createIndex({ userId: 1 });
db.oauth2_access_token.createIndex({ expires: 1 }, { expireAfterSeconds: 0 });
db.cache.createIndex({ e: 1 }, { expireAfterSeconds: 0 });
db.forecast.createIndex({ date: 1 }, { expireAfterSeconds: 1296000 });
db.msg_thread.createIndex({ users: 1, 'lastMsg.date': -1 }, { background: 1 });
db.msg_thread.createIndex(
{ users: 1 },
{ partialFilterExpression: { 'lastMsg.read': false }, background: 1 },
);
db.msg_thread.createIndex({ users: 1, 'lastMsg.date': -1 });
db.msg_thread.createIndex({ users: 1 }, { partialFilterExpression: { 'lastMsg.read': false } });
db.msg_thread.createIndex({ users: 1, 'maskWith.date': -1 });
db.video.createIndex({ 'metadata.likes': -1 });
db.video.createIndex({ tags: 1, 'metadata.likes': -1 });
Expand Down Expand Up @@ -252,8 +247,8 @@ db.plan_charge.createIndex(
db.f_post.createIndex({ topicId: 1, troll: 1 });
db.f_post.createIndex({ createdAt: -1, troll: 1 });
db.f_post.createIndex({ userId: 1 });
db.f_post.createIndex({ categId: 1, createdAt: -1 }, { background: 1 });
db.f_post.createIndex({ topicId: 1, createdAt: -1 }, { background: 1 });
db.f_post.createIndex({ categId: 1, createdAt: -1 });
db.f_post.createIndex({ topicId: 1, createdAt: -1 });
db.external_engine.createIndex({ userId: 1 });
db.external_engine.createIndex({ oauthToken: 1 });
db.tutor_queue.createIndex({ requestedAt: 1 });
Expand All @@ -268,18 +263,18 @@ db.challenge_bulk.createIndex({ by: 1, pairAt: -1 });
db.push_subscription.createIndex({ userId: 1 });
db.team_member.createIndex({ team: 1 });
db.team_member.createIndex({ user: 1 });
db.team_member.createIndex({ team: 1, date: -1 }, { background: 1 });
db.team_member.createIndex({ team: 1, date: -1 });
db.team_member.createIndex({ team: 1, perms: 1 }, { partialFilterExpression: { perms: { $exists: 1 } } });
db.email_domains.createIndex({ nb: -1 }, { background: 1 });
db.email_domains.createIndex({ nb: -1 });
db.game5.createIndex({ ca: -1 });
db.game5.createIndex({ us: 1, ca: -1 });
db.game5.createIndex({ 'pgni.user': 1, 'pgni.ca': -1 }, { sparse: 1 });
db.game5.createIndex({ ck: 1 }, { sparse: 1, background: 1 });
db.game5.createIndex({ pl: 1 }, { sparse: true, background: true });
db.game5.createIndex({ 'pgni.h': 1 }, { sparse: true, background: true });
db.game5.createIndex({ ck: 1 }, { sparse: 1 });
db.game5.createIndex({ pl: 1 }, { sparse: true });
db.game5.createIndex({ 'pgni.h': 1 }, { sparse: true });
db.security.createIndex({ user: 1 });
db.security.createIndex({ ip: 1 });
db.security.createIndex({ fp: 1 }, { sparse: 1, background: 1 });
db.security.createIndex({ fp: 1 }, { sparse: 1 });
db.study.createIndex({ ownerId: 1, createdAt: -1 });
db.study.createIndex({ likes: 1, createdAt: -1 });
db.study.createIndex({ ownerId: 1, updatedAt: -1 });
Expand All @@ -288,27 +283,12 @@ db.study.createIndex({ rank: -1 });
db.study.createIndex({ createdAt: -1 });
db.study.createIndex({ updatedAt: -1 });
db.study.createIndex({ likers: 1 });
db.study.createIndex({ uids: 1 }, { background: true });
db.study.createIndex(
{ topics: 1, rank: -1 },
{ partialFilterExpression: { topics: { $exists: 1 } }, background: 1 },
);
db.study.createIndex(
{ topics: 1, createdAt: -1 },
{ partialFilterExpression: { topics: { $exists: 1 } }, background: 1 },
);
db.study.createIndex(
{ topics: 1, updatedAt: -1 },
{ partialFilterExpression: { topics: { $exists: 1 } }, background: 1 },
);
db.study.createIndex(
{ topics: 1, likes: -1 },
{ partialFilterExpression: { topics: { $exists: 1 } }, background: 1 },
);
db.study.createIndex(
{ uids: 1, rank: -1 },
{ partialFilterExpression: { topics: { $exists: 1 } }, background: 1 },
);
db.study.createIndex({ uids: 1 });
db.study.createIndex({ topics: 1, rank: -1 }, { partialFilterExpression: { topics: { $exists: 1 } } });
db.study.createIndex({ topics: 1, createdAt: -1 }, { partialFilterExpression: { topics: { $exists: 1 } } });
db.study.createIndex({ topics: 1, updatedAt: -1 }, { partialFilterExpression: { topics: { $exists: 1 } } });
db.study.createIndex({ topics: 1, likes: -1 }, { partialFilterExpression: { topics: { $exists: 1 } } });
db.study.createIndex({ uids: 1, rank: -1 }, { partialFilterExpression: { topics: { $exists: 1 } } });
db.study_chapter_flat.createIndex({ studyId: 1, order: 1 });
db.study_chapter_flat.createIndex(
{ 'relay.fideIds': 1 },
Expand Down
3 changes: 3 additions & 0 deletions bin/mongodb/relay-tour-ownerIds.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
db.relay_tour.find().forEach(function (tour) {
db.relay_tour.updateOne({ _id: tour._id }, { $set: { ownerIds: [tour.ownerId] } });
});
Loading

0 comments on commit 2062334

Please sign in to comment.