Enha: nullable roomID for player [WIP]
This commit is contained in:
		| @@ -135,14 +135,22 @@ func getFullInfoByCtx(ctx context.Context) (*models.FullInfo, error) { | ||||
| 		return nil, err | ||||
| 	} | ||||
| 	resp.State = state | ||||
| 	if state.RoomID == "" { | ||||
| 	if state.RoomID == nil { | ||||
| 		return resp, nil | ||||
| 	} | ||||
| 	// room, err := getRoomByID(state.RoomID) | ||||
| 	room, err := repo.RoomGetByID(ctx, state.RoomID) | ||||
| 	room, err := repo.RoomGetByID(ctx, *state.RoomID) | ||||
| 	if err != nil { | ||||
| 		// room was deleted; remove it from player; | ||||
| 		log.Warn("failed to find room despite knowing room_id;", | ||||
| 			"room_id", state.RoomID) | ||||
| 		state.Team = models.UserTeamNone | ||||
| 		state.Role = models.UserRoleNone | ||||
| 		if err := repo.PlayerExitRoom(ctx, state.Username); err != nil { | ||||
| 			log.Warn("failed to exit room", | ||||
| 				"room_id", state.RoomID, "username", state.Username) | ||||
| 			return resp, err | ||||
| 		} | ||||
| 		return nil, err | ||||
| 	} | ||||
| 	resp.Room = room | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Grail Finder
					Grail Finder