Fix: pass username in ctx; more test words
This commit is contained in:
		| @@ -29,20 +29,17 @@ func HandleHideCreateForm(w http.ResponseWriter, r *http.Request) { | ||||
| func HandleShowColor(w http.ResponseWriter, r *http.Request) { | ||||
| 	word := r.URL.Query().Get("word") | ||||
| 	ctx := r.Context() | ||||
| 	tmpl, err := template.ParseGlob("components/*.html") | ||||
| 	if err != nil { | ||||
| 		abortWithError(w, err.Error()) | ||||
| 		return | ||||
| 	} | ||||
| 	session, ok := ctx.Value(models.CtxSessionKey).(*models.Session) | ||||
| 	if !ok { | ||||
| 		// trying to get color without a session -> error | ||||
| 		abortWithError(w, "session not found") | ||||
| 		http.Redirect(w, r, "/", 302) | ||||
| 		return | ||||
| 	} | ||||
| 	// // get room by room-id | ||||
| 	// room, err := getRoomByID(session.CurrentRoom) | ||||
| 	// if err != nil { | ||||
| 	// 	log.Error("failed to get room", "error", err, "session", session) | ||||
| 	// 	abortWithError(w, "failed to get room") | ||||
| 	// 	return | ||||
| 	// } | ||||
| 	// log.Debug("got room", "room", room) | ||||
| 	state, err := loadState(session.Username) | ||||
| 	if err != nil { | ||||
| 		abortWithError(w, err.Error()) | ||||
| @@ -56,11 +53,6 @@ func HandleShowColor(w http.ResponseWriter, r *http.Request) { | ||||
| 		abortWithError(w, "word is not found") | ||||
| 		return | ||||
| 	} | ||||
| 	tmpl, err := template.ParseGlob("components/*.html") | ||||
| 	if err != nil { | ||||
| 		abortWithError(w, err.Error()) | ||||
| 		return | ||||
| 	} | ||||
| 	cardword := models.WordCard{ | ||||
| 		Word:     word, | ||||
| 		Color:    models.StrToWordColor(color), | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Grail Finder
					Grail Finder