Fix board template being ignored when set on default ruleset

The lobby ready handler only checked lobby.BoardTemplateIdOverride and
never fell back to dbDefaults.BoardTemplateId, so templates configured
on the admin default GameRuleSet were silently skipped and the
auto-shape generator ran instead.

Apply the same override → default fallback chain as all other rules:
  effectiveTemplateId = lobby.BoardTemplateIdOverride ?? dbDefaults?.BoardTemplateId

Generated with [Claude Code](https://claude.ai/code)
via [Happy](https://happy.engineering)

Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Happy <yesreply@happy.engineering>
This commit is contained in:
dingo
2026-03-27 23:15:45 -04:00
co-authored by Claude Happy
parent 4138ba39e7
commit 225a16e4a3
@@ -232,11 +232,14 @@ internal sealed class GameLobbyReadyHandler : GameHandlerBase, IMessageHandler
// If the lobby specifies a board template, load it and build a snapshot JSON string
// that will be embedded in the rule snapshot so in-flight games are unaffected by later edits.
// Fallback chain: lobby override → admin custom-default ruleset → none.
var effectiveTemplateId = lobby.BoardTemplateIdOverride ?? dbDefaults?.BoardTemplateId;
string? boardTemplateJson = null;
if (lobby.BoardTemplateIdOverride.HasValue)
if (effectiveTemplateId.HasValue)
{
var tmpl = await _gameDb.BoardTemplates
.FindAsync(new object[] { lobby.BoardTemplateIdOverride.Value }, ct);
.FindAsync(new object[] { effectiveTemplateId.Value }, ct);
if (tmpl is not null)
{
var tileOpts = new JsonSerializerOptions(JsonSerializerDefaults.Web);