Feat: card_mark repo
This commit is contained in:
@ -201,7 +201,6 @@ func HandleMarkCard(w http.ResponseWriter, r *http.Request) {
|
||||
abortWithError(w, err.Error())
|
||||
return
|
||||
}
|
||||
// color, exists := fi.Room.WCMap[word]
|
||||
color, exists := fi.Room.FindColor(word)
|
||||
log.Debug("got mark-card request", "word", word, "color", color)
|
||||
if !exists {
|
||||
@ -221,7 +220,7 @@ func HandleMarkCard(w http.ResponseWriter, r *http.Request) {
|
||||
// Check if the current user already has an active mark on this card
|
||||
found := false
|
||||
var newMarks []models.CardMark
|
||||
for _, mark := range card.Mark {
|
||||
for _, mark := range card.Marks {
|
||||
if mark.Username == fi.State.Username && mark.Active {
|
||||
found = true
|
||||
} else {
|
||||
@ -234,7 +233,7 @@ func HandleMarkCard(w http.ResponseWriter, r *http.Request) {
|
||||
Active: true,
|
||||
})
|
||||
}
|
||||
fi.Room.Cards[i].Mark = newMarks
|
||||
fi.Room.Cards[i].Marks = newMarks
|
||||
cardword = fi.Room.Cards[i]
|
||||
}
|
||||
if err := saveFullInfo(r.Context(), fi); err != nil {
|
||||
|
@ -28,8 +28,8 @@ func GetSession(next http.Handler) http.Handler {
|
||||
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||
sessionCookie, err := r.Cookie(models.AuthCookie)
|
||||
if err != nil {
|
||||
msg := "auth failed; failed to get session token from cookies"
|
||||
log.Debug(msg, "error", err)
|
||||
// msg := "auth failed; failed to get session token from cookies"
|
||||
// log.Debug(msg, "error", err)
|
||||
next.ServeHTTP(w, r)
|
||||
return
|
||||
}
|
||||
|
Reference in New Issue
Block a user