Saved games on user profiles#126
Merged
Merged
Conversation
byte-the-bot
force-pushed
the
saved-games
branch
from
July 13, 2026 01:14
c943572 to
95a07c0
Compare
Users can save any game to their public profile with an optional title,
matching the saved-games feature from play.battlesnake.com (BS-219e7007).
- saved_games table: one row per (user, game), UNIQUE-constrained so
re-saving a game upserts the title instead of duplicating.
- Save form in the game page aside (logged-in only): pre-fills the
existing title and switches to an "Update" label when already saved.
- Saved Games section on the public profile: links to the game, falls
back to "{game_type} on {board_size}" when untitled, and shows a
Remove button to the owner (delete is owner-scoped, 404 otherwise).
- Titles are trimmed and capped at 100 chars server-side.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
byte-the-bot
force-pushed
the
saved-games
branch
from
July 13, 2026 02:04
95a07c0 to
d9307ff
Compare
byte-the-bot
enabled auto-merge (squash)
July 13, 2026 02:05
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Implements task BS-219e7007: users can save games to their public profile with an optional title, matching the saved-games feature from play.battlesnake.com.
(Originally stacked on #121 /
public-profiles; that PR has since merged, so this now targetsmaindirectly and includes only the saved-games work.)What's included
saved_gamestable —UNIQUE (user_id, game_id)so a user can save a game once; FK'd tousersandgames. Up + down migrations.server/src/models/saved_game.rs): upsert-on-save (re-saving updates the title in place), owner-scoped delete, and a profile listing query joined withgamesfor fallback-title metadata.POST /games/{id}/save— optionaltitleform field, trimmed and capped at 100 chars server-side; flashes "Game saved to your profile" and redirects back to the game page. 404s for nonexistent games.POST /saved-games/{id}/delete— owner-only (404 for anyone else), flashes and redirects to the owner's/users/{login}profile.view.rs.Testing
#[sqlx::test]model tests: upsert behavior (same row updated on re-save, separate rows per user) and owner-scoped delete.cargo clippy --all-targetswarning-free,cargo fmtclean, full suitecargo test -p arena --bin arenagreen (384 passed)..sqlxoffline cache regenerated and committed.🤖 Generated with Claude Code