Enha: roomid confusion
This commit is contained in:
		| @@ -135,11 +135,13 @@ func getFullInfoByCtx(ctx context.Context) (*models.FullInfo, error) { | ||||
| 		return nil, err | ||||
| 	} | ||||
| 	resp.State = state | ||||
| 	if state.RoomID == nil { | ||||
| 	if state.RoomID == nil || *state.RoomID == "" { | ||||
| 		log.Debug("returning state without room", "username", state.Username) | ||||
| 		return resp, nil | ||||
| 	} | ||||
| 	// room, err := getRoomByID(state.RoomID) | ||||
| 	room, err := repo.RoomGetByID(ctx, *state.RoomID) | ||||
| 	room, err := repo.RoomGetExtended(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;", | ||||
|   | ||||
| @@ -52,7 +52,8 @@ func HandleHome(w http.ResponseWriter, r *http.Request) { | ||||
| 	if err != nil { | ||||
| 		log.Error("failed to fetch fi", "error", err) | ||||
| 	} | ||||
| 	if fi != nil && fi.Room != nil && fi.State != nil { | ||||
| 	// there must be a better way | ||||
| 	if fi != nil && fi.Room != nil && fi.Room.ID != "" && fi.State != nil { | ||||
| 		fi.Room.UpdateCounter() | ||||
| 		if fi.State.Role == "mime" { | ||||
| 			fi.Room.MimeView() // there must be a better way | ||||
|   | ||||
| @@ -380,7 +380,7 @@ type WordCard struct { | ||||
| 	Word     string     `json:"word" db:"word"` | ||||
| 	Color    WordColor  `json:"color" db:"color"` | ||||
| 	Revealed bool       `json:"revealed" db:"revealed"` | ||||
| 	Mime     bool       `json:"mime" db:"mime"` // user who sees that card is mime | ||||
| 	Mime     bool       `json:"mime" db:"mime_view"` // user who sees that card is mime | ||||
| 	Mark     []CardMark `json:"marks" db:"-"` | ||||
| } | ||||
|  | ||||
|   | ||||
| @@ -33,6 +33,9 @@ func (p *RepoProvider) PlayerGetByName(ctx context.Context, username string) (*m | ||||
| 	if err != nil { | ||||
| 		return nil, err | ||||
| 	} | ||||
| 	if player.RoomID != nil && *player.RoomID == "" { | ||||
| 		player.RoomID = nil | ||||
| 	} | ||||
| 	return &player, nil | ||||
| } | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Grail Finder
					Grail Finder