dkforest

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

commit eae203d9202a5bb098aef314890498d0bcb8159f
parent 8deb84bbd01f03d5afd6562a2cb1fa6df11b0d01
Author: n0tr1v <n0tr1v@protonmail.com>
Date:   Fri, 26 May 2023 02:35:48 -0700

Fix very cryptic bug that cause chess notifications to not be send properly

Diffstat:
Mpkg/database/utils/utils.go | 5++++-
1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/pkg/database/utils/utils.go b/pkg/database/utils/utils.go @@ -48,7 +48,10 @@ func SendNewChessGameMessages(db *database.DkfDB, key, roomKey string, roomID da if user.ID == player1.ID || user.ID == player2.ID { continue } - _, _ = db.CreateMsg(raw, msg, roomKey, roomID, zeroUser.ID, &user.ID) + // Make a copy of user ID, otherwise next iteration will overwrite the pointer + // and change data that was sent previously in the pubsub later on + userID := user.ID + _, _ = db.CreateMsg(raw, msg, roomKey, roomID, zeroUser.ID, &userID) } }