fix(robot): show the per-game name in REST game views, not the account name
CI / changes (pull_request) Successful in 2s
CI / unit (pull_request) Successful in 9s
CI / integration (pull_request) Successful in 13s
CI / ui (pull_request) Successful in 50s
CI / gate (pull_request) Successful in 0s
CI / deploy (pull_request) Successful in 1m18s
CI / changes (pull_request) Successful in 2s
CI / unit (pull_request) Successful in 9s
CI / integration (pull_request) Successful in 13s
CI / ui (pull_request) Successful in 50s
CI / gate (pull_request) Successful in 0s
CI / deploy (pull_request) Successful in 1m18s
The seat display-name snapshot only reached the live-event path (seatNames);
the REST DTO layer still resolved seat names from the account store
(fillSeatNames), so the game screen and lobby list showed the robot's seeded
account name ("Женя") while the your_turn toast showed its per-game name
("Звёздный_Барс2"). Carry the snapshot into gameDTOFromGame and have
fillSeatNames fall back to the account only for a seat with no snapshot (a
pre-snapshot legacy row). Friends and invitations keep account names (the
persistent identity, not a per-game disguise).
This commit is contained in:
@@ -66,10 +66,15 @@ type complaintRequest struct {
|
||||
Note string `json:"note"`
|
||||
}
|
||||
|
||||
// fillSeatNames resolves each seat's display name from the account store, memoising
|
||||
// across seats and games within one request.
|
||||
// fillSeatNames fills each seat's display name from the account store — memoising across
|
||||
// seats and games within one request — for the seats that carry no per-game snapshot yet
|
||||
// (a pre-snapshot legacy row). A seat whose snapshot is already set is left untouched, so
|
||||
// a disguised robot keeps its per-game name rather than reverting to its account name.
|
||||
func (s *Server) fillSeatNames(ctx context.Context, g *gameDTO, memo map[string]string) {
|
||||
for i := range g.Seats {
|
||||
if g.Seats[i].DisplayName != "" {
|
||||
continue // the seat already carries its per-game snapshot
|
||||
}
|
||||
id := g.Seats[i].AccountID
|
||||
name, ok := memo[id]
|
||||
if !ok {
|
||||
|
||||
Reference in New Issue
Block a user