dkforest

A forum and chat platform (onion)
git clone https://git.dasho.dev/n0tr1v/dkforest.git
Log | Files | Refs | LICENSE

commit 6e6b67f7175e0eec22d8a1c07b164ae401f4fc22
parent 1fd07b660fba91674b004b887383fcc48060d9f8
Author: n0tr1v <n0tr1v@protonmail.com>
Date:   Wed,  6 Dec 2023 14:49:51 -0500

add logs for player sit/unsit

Diffstat:
Mpkg/web/handlers/poker/poker.go | 4++++
1 file changed, 4 insertions(+), 0 deletions(-)

diff --git a/pkg/web/handlers/poker/poker.go b/pkg/web/handlers/poker/poker.go @@ -758,6 +758,7 @@ func PokerDealHandler(c echo.Context) error { func PokerUnSitHandler(c echo.Context) error { authUser := c.Get("authUser").(*database.User) roomID := c.Param("roomID") + roomLogsTopic := "room_" + roomID + "_logs" g := PokerInstance.GetGame(roomID) if g == nil { return c.NoContent(http.StatusNotFound) @@ -776,6 +777,7 @@ func PokerUnSitHandler(c echo.Context) error { if found { myTopic := "room_" + roomID PokerPubSub.Pub(myTopic, PokerSeatLeftEvent{Idx: idx + 1}) + newLogEvent(g, roomLogsTopic, fmt.Sprintf("%s un-sit", authUser.Username.String())) } } return c.HTML(http.StatusOK, `<form method="post"><button>UnSit</button></form>`) @@ -791,6 +793,7 @@ func PokerSitHandler(c echo.Context) error { pos-- roomID := c.Param("roomID") roomTopic := "room_" + roomID + roomLogsTopic := "room_" + roomID + "_logs" g := PokerInstance.GetGame(roomID) if g == nil { return c.HTML(http.StatusOK, html) @@ -801,6 +804,7 @@ func PokerSitHandler(c echo.Context) error { return c.HTML(http.StatusOK, html) } PokerPubSub.Pub(roomTopic, PokerSeatTakenEvent{}) + newLogEvent(g, roomLogsTopic, fmt.Sprintf("%s sit", authUser.Username.String())) } return c.HTML(http.StatusOK, html) }