Skip to content

Bookmark game positions#19312

Draft
OwenKrawecki wants to merge 30 commits intolichess-org:masterfrom
OwenKrawecki:bookmark-persistent-ply
Draft

Bookmark game positions#19312
OwenKrawecki wants to merge 30 commits intolichess-org:masterfrom
OwenKrawecki:bookmark-persistent-ply

Conversation

@OwenKrawecki
Copy link

No description provided.

conf/routes Outdated

# Bookmark
POST /bookmark/$gameId<\w{8}> controllers.Game.bookmark(gameId: GameId)
POST /bookmark/$gameId<\w{8}>/:ply controllers.Game.bookmark(gameId: GameId, ply: chess.Ply)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this unnecessarily breaks compatibility. The ply should be optional.

(for
f <- fen
u <- uci
yield add(gameId, userId, nowInstant, ply, f, u)).getOrElse(Future {})
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

now refuses to add bookmarks without ply & fen & uci

import chess.format.SimpleFen
import chess.format.Uci

case class Bookmark(game: Game, user: User)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The data model is usually the place to start.

You want to add an optional ply, and you need to store fen/lastMove for display.

case class Bookmark(game: Game, user: User, Option[BookmarkPosition] = None)
case class BookmarkPosition(ply: Ply, fen: SimpleFen, lastMove: Uci)

@@ -951,6 +951,9 @@ export default class RoundController implements MoveRootCtrl {

bindBookmarkButton(() => ({
ply: this.ply,
fen: this.chessground.getFen(),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this.stepAt(ply).fen?

htmlText: `
<div class="continue-with">
<a class="button" rel="nofollow">${i18n.site.bookmarkThisGame}</a>
<a class="button" rel="nofollow">${i18n.site.bookmarkThisPosition}</a>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

<a> is for links. These are `.

`,
actions: [
{
selector: 'a:first-child',
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

weak selector. Use classes instead

lila.log("FEN").info(fen.toString())
lila.log("UCI").info(uci.toString())
def bookmark(gameId: GameId) = AuthOrScopedBody(_.Web.Mobile) { _ ?=> me ?=>
val position = BookmarkPosition(get("ply"), get("fen"), get("col"), get("uci"))
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

color please. We haven't used the col abbrv anywhere yet, let's not start

@OwenKrawecki OwenKrawecki marked this pull request as ready for review February 15, 2026 11:45
@OwenKrawecki OwenKrawecki marked this pull request as draft February 17, 2026 06:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

Comments